This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about gcc 3.x


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]