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>
{
private:
  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?

Thanks,

Dave

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.

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

list<T>::iterator

but that doesn't work...

Based on what I see, I don't think "T" is a valid type.

What is T?

T is the type that the class is templated on:

template <class T>

This seemed to do the trick:

typename list<T>::Iterator loopIter;

Thanks,

Dave