Hi,
I have a problem in a template with a class definition.
In a template class (Foo) ther is a class (Bar) and a list
of pointer to this class (m_l). In Foo's destructor I would like
to clear the list but I can't define the iterator to scan the list.
The reducted code is:
# include <list>
template <class T>
class Foo {
class Bar {
public:
int i;
};
std::list<Bar* m_l;
T m_value;
// other stuff
~Foo() {
// gcc 4.1.1 error: expected `;' before 'i'
std::list<Bar*>::iterator i;
for (i = m_l.begin(); i != m_l.end(); i++) {
delete *i;
}
}
};
Changing the Bar* argument to char* in the line with problem all works
well,
but is not what I want!
What I need to correct the iterator definition?
Thanks in advance,
Marco