#ifndef LIST_ITERATORH #define LIST_ITERATORH struct node { int value; node *next; }; class list_iterator { node *p; public: list_iterator(node *initial_p): p(initial_p) {} int& operator*() const {return p->value;} list_iterator& operator++() {p = p->next; return *this;} friend bool operator!=(const list_iterator& it1, const list_iterator& it2) { return it1.p != it2.p; } }; #endif