Simple program won't compile

Alexandre Oliva aoliva@redhat.com
Sun Jan 21 22:34:00 GMT 2001


On Jan 22, 2001, Rodrigo de Salvo Braz <braz@students.uiuc.edu> wrote:

> Basically, I can't use iterators of containers that are
> arguments of template functions. Does anyone knows why?

Because template-dependent nested type names must be preceded by the
keyword `typename' in ISO C++:

> template <class Container> void foo (Container& c) {
>         Container::iterator i; // THIS IS THE PROBLEM.
       ^^ typename

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


More information about the Gcc mailing list