I am trying to get some code I found online to compile. It looked like this:

#include <iostream>
#include <list>

using std::list;

template <class T>
class leda_list : public std::list<T>
  iterator loopIter;

the error was: ‘iterator’ does not name a type

I tried changing it to:

list<T>::iterator loopIter;

but it says "ISO C++ forbids declaration of ‘iterator’ with no type".

Any thoughts on what could be the problem?



How about an example...

To get an iterator for a vector of integers (named iVectorIt) you need to use vector<int>::iterator iVectorIt .

Take that and apply it to your list.

Edited 6 Years Ago by Fbody: n/a

Right... so to generate an iterator for a list of T's, you need to use


but that doesn't work...

This seemed to do the trick:

typename list<T>::Iterator loopIter;



Edited 6 Years Ago by daviddoria: n/a

This article has been dead for over six months. Start a new discussion instead.