I am trying to represent a PDF object type in c++ using variants. A PDF object is one of the following:
Boolean
Integer
Real
String
Name
Stream
Array<Object>
Map<Object, Object>
As you can see, the Object
type is mutually recursive because the Array
type would require a declaration of the Map
type which would require a declaration of the Array
type. How could I go abouts representing this type in c++? If a variant isn't the best way, what is?
Here is what I have tried so far but it doesn't compile because of the requirements of std::unordered_map
(I think) http://coliru.stacked-crooked.com/a/699082582e73376e
int_tree_t
in a variant of itself, however I need to refer to a typedef which hasn't been defined yet – Fernferna