// Created by Frank M. Carrano and Tim Henry. // Copyright (c) 2013 __Pearson Education__. All rights reserved. /** ADT list: Link-based implementation. Listing C6-1. @file LinkedIterator.h */ #ifndef _LINKED_ITERATOR #define _LINKED_ITERATOR #include #include "Node.h" using namespace std; template class LinkedList; template class LinkedIterator : public iterator { private: // ADT associated with iterator const LinkedList* containerPtr; // Current location in collection Node* currentItemPtr; public: LinkedIterator(const LinkedList* someList, Node* nodePtr); /** Dereferencing operator overload. @return The item at the position referenced by iterator. */ const ItemType operator*(); /** Prefix increment operator overload. @return The iterator referencing the next position in the list. */ LinkedIterator operator++(); /** Equality operator overload. @param LinkedList The iterator for comparison. @return True if this iterator references the same list and the same position as rightHandSide, false otherwise. */ bool operator==(const LinkedIterator& rightHandSide) const; /** Inequality operator overload. @param LinkedList The iterator for comparison. @return True if this iterator does not reference the same list and the same position as rightHandSide, false otherwise. */ bool operator!=(const LinkedIterator& rightHandSide) const; }; // end LinkedIterator #include "LinkedIterator.cpp" #endif