- If you have implemented lists,
and you wish to perform an operation on all the elements in a list,
then you should define the
iterator class,
and you should create an iterator object by
instantiating the following pattern:
iterator<object type> iterator name (list name);
- If you have implemented iterators,
and you wish to work on the object pointed to by an iterator
class object,
and you have defined an
access member function,
then instantiate the following pattern:
iterator name.access ( )
- If you have implemented iterators,
and you wish to move an iterator class object's pointer to the
next link in a list,
and you have defined a
advance member function,
then instantiate the following pattern:
iterator name.advance ( )
- If you have implemented iterators, and you
wish to work on all the elements in a list, and you have created an iterator
class object using a class with
access, advance, endp,
and reset member functions, then instantiate the following pattern:
iterator name.reset ( );
for (; iterator name.endp ( ) ; iterator name.advance ( )) {
... iterator name.access ( ) ...
}