What\'s the best solution to forward declare a typedef within a class. Here\'s an example of what I need to solve:
class A;
class B;
class A
{
typedef boos
You're facing two distinct difficulties: 1. There are no forward declarations of typedefs 2. Forward declarations of nested types are not possible
There is no way around the second: you have to unnest the types.
One way around the first that I occasionally use is to make a derived type, and that yes, can be forwardly declared.
Say:
struct Ptr : shared_ptr {};
This is a new type, but it is almost the same as a synonym. The problem, of course, is constructors, but that is getting better with C++11.
This answer, of course, is in general. For your specific case, I think you should define the Ptrs outside the classes and you would have no problem at all.
struct A;
struct B;
typedef shared_ptr APtr;
typedef shared_ptr BPtr;
and then the classes.