I'm trying to port code from
VC.net to
VC.net 2003. Here's a typical piece of code that's often used:
Code:
template<class T> class PseudoContainer {
	typedef T::iterator iterator; // this line will change in the next example...
};
This compiles just fine under
VC.net but it will
not compile under
VC.net 2003. In order to get this to compile with the new compiler, I need to add the
typename keyword, like so:
Code:
template<class T> class PseudoContainer {
	typedef typename T::iterator iterator; // this line was changed from the previous example...
};
Now, I can actually understand
why you need the
typename keyword. It's because the compiler can't tell if
T::iterator is a type or a static member of
T. Thus, you must tell it with the
typename keyword. However, if that's the case, then why did it compile just fine under
VC.net?
Any insight into this will be greatly appreciated!