In terms of dependency, names of all types in one header are likely to be a service nightmare. This is understandable for typedef because you want a unique definition, but there is no reason to forward the class declaration here.
There is no point in striking to declare a class symbol: you are polluting your own namespace. Let each file independently determine whether it needs a symbol or not, and the redirection declares it on its own.
It is not so simple to declare a ClassList : it should be available only to those who need it. You can create a specific header for directly declaring a class related things:
// class_fwd.h namespace myproject { class Class; typedef std::list<Class> ClassList; } // namespace myproject // class.h #include "myproject/class_fwd.h" namespace myproject { class Class {}; } // namespace myproject
source share