There is such code:
template <class T>
class SomeClass{
typedef boost::shared_ptr<T> sPtr;
typedef std::vector<sPtr> c;
typedef c::iterator cIt; // here is the problem
};
and the error is:
main.cpp:23: error: type ‘std::vector<boost::shared_ptr<X>, std::allocator<boost::shared_ptr<X> > >’ is not derived from type ‘SomeClass<T>’
main.cpp:23: error: expected ‘;’ before ‘cIt’
How to use typedef to templated parameters in class?
EDIT:
I figured it out, for g++ that must be:
typedef typename c::iterator cIt; // here is the problem
Please close it.
The problem is that
c::iteratoris a qualified-id, and the type ofcdepends on a template paramater. According to§14.6/3: