![]() |
[C++] Why do I need the typename keyword?
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...
}; Code:
template<class T> class PseudoContainer {
	typedef typename T::iterator iterator; // this line was changed from the previous example...
}; Any insight into this will be greatly appreciated! |
VC6's template compiler is implemented almost like a macro. I can get some crazy shit to work that shouldn't under VC6... The parsing done by VC6 to a template is very minimal before it is instantiated. (I could be on crack, but this theory is consistent with the poking around I've done with templates)
When they did VC.net, they implemented a 'real' template compiler. Along the way, they ended up parsing more of the contents of a template. Which means they needed to know of a token was a type or a constant. |
All times are GMT -8. The time now is 03:46 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project