void* pointers and would not know how to delete the items. There is an associated iterator class for SequentialList called ListIter.
int size() const;Return the size of the list.
Pointer head() const;Return the first item from the list (0 if the list is empty). The list is not changed.
Pointer tail() const;Return the last item from the list (0 if the list is empty). The list is not changed.
Pointer elem(int n) const;Return the
nthitem on the list (0 if there are fewer than
nitems). Note that the time required is proportional to
int empty() const;Return 1 if the list is empty, 0 if it is not.
int member(Pointer arg) const;Return 1 if the list has a Pointer that is equal to
arg,0 if not.
void prepend(Pointer p);Add an item at the beginning of the list.
void append(Pointer p);Add an item at the end of the list.
int remove(Pointer p);Remove the pointer
pfrom the list if it is present (the test is pointer equality). Return 1 if present, 0 if not.
Pointer getAndRemove();Return and remove the head of the list. If the list is empty, return a null pointer (0).
Pointer getTailAndRemove();Return and remove the last item on the list.
void initialize();Remove all links from the list. This does not delete the items pointed to by the pointers that were on the list.
const SequentialListand the ++ operator (or
nextfunction) returns a
Pointer.Class ListIter is a friend of class SequentialList. In addition to the standard iterator functions
reset,this class also provides a function
void reconnect(const SequentialList&
that attaches the ListIter to a different SequentialList.