In a template, a name with a parameter-dependent
qualifier is not taken to be a type unless it is explicitly declared
as one with the typename keyword.
You need to explicitly declare a type or a member function
type using the typename keyword when all of the following are true:
The code is inside a template.
The name is qualified (i.e., it has a "::" token
in it).
The qualifier (to the left of the "::" token)
depends on a template parameter.
For example, the following code includes the typename keyword
to declare iterator as a type:
#include <list> template <class Element> class Foo { public: list<Element> e; typedef typename list<Element>::iterator MyIterator; }; |
For more information, refer to the HP aC++ Transition
Guide at the following World Wide Web URL:
http://www.hp.com/esy/lang/cpp/tguide |