std::list iterator problem

Started by
3 comments, last by madRenEGadE 16 years, 4 months ago
Hello I have the following problem: When writing this code: typedef std::list<boost::shared_ptr<OctreeNode<T> > > RootNodeList; RootNodeList::iterator i; The compiler outputs the this error: Error: expected `;' before »i« Where the hell does this come from? thx in advance
Advertisement
Try changing it to typename RootNodeList::iterator i;

Because RootNodeList::iterator could be either a member or a type (depending on T) you have to tell the compiler to treat it as a type.

The error message isn't very helpful though.
Ok changed to typename but now I get another error when I try to create a list from this type:

RootNodeList m_rootNodes;

The compiler says that RootNodeList does not name a type.
Same basic problem as dicussed in this thread.

The following should work:
typename RootNodeList::iterator i;
ok this works...strange ^^

thx for the help

This topic is closed to new replies.

Advertisement