Question about gcc 3.x

Joe Buck jbuck@synopsys.com
Fri Nov 8 09:42:00 GMT 2002


> Thanks, it works by adding the keyword 'typename'. I did not know about this 
> keyword, and I do not understand why this keyword must be added. I will look 
> for an updated C++ book in the next weeks.

The reason is to allow C++ templates to be completely parsed at the time
they are declared, instead of waiting for them to be instantiated.
Roughly speaking, a name that is not defined in the template itself, or
provided as a typename/class argument to the template, is assumed to be an
identifier.  If it is supposed to be a type, the typename keyword must be
used.



More information about the Gcc mailing list