previous | start | next

## Implementing Linked Lists (Implementing Iterators)

- Note that it is illegal to advance the iterator once it is in the past-the-end position.

  >     void Iterator::next()
  >     {
  >        assert(position != NULL)
  >        position = position->next;
  >     }

- The previous function is similar.
- When the iterator points to the first element in the list, it is illegal to move it further backward.

  >     void Iterator::previous()
  >     {
  >        if (position == NULL)
  >           position = last;
  >        else
  >           position = position->previous;
  >        assert(position != NULL);
  >     }

previous | start | next