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]

Re: Template members


David Greene writes:

> A quick question on template member syntax, and whether
> egcs is behaving correctly:

It is.

> I have a line of code that looks like this (e is an STL
> iterator):

> myAttribute attr = (*e).getNode()->getAttribute<myAttribute>();

The `template' keyword is mandatory just after `->' when you
explicitly specify template arguments for a template member function,
in order to disambiguate.  If it is missing, the expression must be
parsed as:

(((*e).getNode()->getAttribute) < (myAttribute)) > ()

that is, `<' is taken as a less-than operator.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil


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