I have code that looks like this:
template<class T>
class list
{
public:
class iterator;
};
template<class T>
class list::iterator
{
public:
iterator();
protected:
list* lstptr;
};
list<T>::iterator::iterator()
{
//???
}
I want to make the constructor of list::iterator
to make iterator::lstptr
point to the list it's called from. I.e.:
list xlst;
xlst::iterator xitr;
//xitr.lstptr = xlst
How would I do that?
And also, am I referencing my iterator-constructor right, or should I do something like this:
template<class T>
class list<T>::iterator
{
public:
list<T>::iterator();
protected:
list* lstptr;
};