the problem is that vector<T> is an incomplete type, therefore the compiler does not have enough information on its own to determine whether vector<T>::iterator is a type or something else.
The solution is to provide the compiler with an extra hint that vector<T>::iterator is indeed a type, with the
typename keyword
CODE
template <typename T> class myClass {
private:
typedef vector<T> tVector;
typedef typename tVector::iterator tIterator;
The reason the compiler does this, it is entirely possible to create your own specialisation of vector, where vector::iterator is not a type - But since the compiler cannot possibly check every single possible variation on vector<T>::iterator, its up to the you, the programmer to make the assertion that you really did mean to use a type there.
This post has been edited by Bench: 14 Jan, 2008 - 08:21 AM