Impossible, consider what types will be:
timestamp_to_key_type = map< long long, key_to_value_type::iterator > = map< long long, map< K, pair< V, timestamp_to_key_type::iterator > >::iterator > = map< long long, map< K, pair< V, map< long long, map< K, pair< V, map< long long, map< K, pair < V ...
This is not a problem with forward declarations; you are simply trying to describe a type that is recursively defined by itself. This is no different from:
struct A { B b; }; struct B { A a; };
The only way around this is to lose some static type information. As you said, you can use void* , or you can try defining your own abstract, erasable interface. Your choice.
Peter Alexander
source share