To define these two class
typedef map<C, B::iterator> A;
typedef list<D, A::iterator> B;
The class A and B mutual contain each other’s iterator.
The compiler complains about above statement.
How to solve the problem ?
iammilind says it is impossible. but this logic relationship appears, for example a priority queue. So any one have workaround?
Unfortunately, it’s not possible.
AandBare interdependent, so at least one of them has to be forward declared to support the other.But the
typedeftypes cannot be forward declared asclass/struct.