template bug? using T::iterator, where T is parameter.
Alexandre Oliva
oliva@dcc.unicamp.br
Fri Oct 10 20:57:00 GMT 1997
Yotam Medini writes:
> This examples worked fine with g++, Solaris's CC and IBM's xlC.
they're all all broken :-)
Type names that depend on a template argument must be preceded by the
`typename' keyword. So, your show2nd template function should be
written like this:
> show2nd(ostream& os, const T& container)
> {
typename
> T::const_iterator i = container.begin();
> i++;
typename
> T::value_type vt = *i;
> os << vt;
> return(os);
> }
Now egcs compiles it successfully.
--
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-bugs
mailing list