
"David Abrahams" <dave@boost-consulting.com> wrote in message news:ulkzlbiyw.fsf@boost-consulting.com...
It's not a question of "fully using." If the vector type is instantiated before the parameter is fully defined, it's an error. Otherwise, you're OK. The forward declaration technique can be used legally in many scenarios.
The problem arises when I need an iterator - a nested typedef within vector, which as I understand it, requires the vector's value type to be defined, so that the vector template class, of that type, can be instantiated. For example: ---------------------------------- Foo.h ---------------------------------- class Foo { ... }; ---------------------------------- FooAction.h ---------------------------------- #include "Foo.h" class FooAction { public: typedef std::list<Foo> FooList; private: // The following causes us to need class Foo to be fully defined and not just declared. FooList::iterator m_iFooList; }; ---------------------------------- FooContainer.h ---------------------------------- #include "Foo.h" // This is definitely needed #include "FooAction.h" // Is this really needed? class FooContainer { public: typedef std::list<Foo> FooList; typedef std::vector<FooAction> FooActionVector; void GetActionableFoos(FooActionVector &actions); private: FooList m_listOfFoos; };