Template members

Alexandre Oliva oliva@dcc.unicamp.br
Fri Feb 13 02:04:00 GMT 1998


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



More information about the Gcc mailing list