implementing iterator in copy ctor
my current copy ctor looks like this:
Code:
template <typename T> List<T>::List<T>(const List& src) : head(new Node(T())), tail(new Node(T()))
{
clear(); // This deletes all the Nodes in the list
for( Node* temp = ( src.head )->next; temp != src.tail; temp = temp->next )
{
pushb( temp->data ) ;
}
}
I have a public Iterator class declared in the List class:
Code:
class List
{
public:
class Iter;
Iter begin(){ return Iter(head); }
Iter end(){ return Iter(tail); }
I've overloaded the operator++(pre & post) , operator--(pre & post) and the operator*.
How can I implement my Iter's in my copy ctor? What I'm worried about is the src.head & src.tail.