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]

Simple program won't compile


Hi,

This program doesn't compile in gcc, although it does in a Borland
compiler. Basically, I can't use iterators of containers that are
arguments of template functions. Does anyone knows why? Thanks in advance!

#include <iostream>
#include <list> 
  
template <class Container>
void foo (Container& c)   
{
        list<char>::iterator j; // iterator ok.
        Container a = c;       // This is ok.
        Container::iterator i; // THIS IS THE PROBLEM.
                               // Message: parse error before ';'
}
 
int main (char* argv[], int argc)
{
        list<int> a;
        foo(a);
        return 0;
}



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