Re: Iterator over a map of generic vectors.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Eric Lance" <eric.lance@xxxxxxxxx> writes:

> I'm trying to figure out if this is a bug or "feature". In a generic
> function, I want to declare an iterator over a map whose values are
> generic vectors. However, I get a syntax error whenever I try to
> declare this particular kind of iterator. The code snippet below
> should illustrate what I mean better:
> 
> template<typename T>
> void func()
> {
>     map< int, vector<T> > m;             //we want an iterator over m.
>     map< int, vector<T> >::iterator i;      //this doesn't compile
>     map< int, vector<int> >::iterator k;   //but this does
> }

This is not a gcc question.  In standard C++ you need to say
  typename map< int, vector<T> >::iterator i;

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux