1 #ifndef DOUBLY_LINKED_LIST_CLASS
2 #define DOUBLY_LINKED_LIST_CLASS
183 bool skip_or_ignore(
iterator &where,
int count);
iterators allow the list to be traversed.
void jump_head()
set the iterator to the head.
void jump_tail()
set the iterator to the tail.
void next()
synonym for ++.
void previous()
synonyms for –.
iterator(const doubly_linked_list *mgr, node *start)
opens up an iterator on a list.
bool is_tail() const
returns true if the cursor is at the tail of the list.
bool is_head() const
returns true if the cursor is at the head of the list.
node * access()
obtain access to the current element.
const node * observe()
peek at the current element.
bool operator==(const iterator &to_compare) const
returns true if the two iterators are at the same position.
void operator--()
go to previous item.
void operator++()
go to next item.
Implements a guarded, doubly linked list structure.
bool backward(iterator &where, int count)
moves the list pointer "count" items towards the head.
iterator tail() const
returns an iterator located at the tail of the list.
bool forward(iterator &where, int count)
moves the list pointer "count" items towards the tail.
int elements() const
returns the number of items currently in the list.
int index(const iterator &it) const
returns the zero-based index of the cursor's position from the head.
bool empty() const
returns true if the list is empty.
~doubly_linked_list()
invalidates all contents of the list and destroys all child nodes.
int items_from_head(const iterator &where) const
Returns the number of elements between the current item and the head.
doubly_linked_list()
constructs a blank list.
iterator head() const
returns an iterator located at the head of the list.
node * remove(iterator &where)
extracts the current item from "where" and repairs the hole.
void append(iterator &where, node *new_node)
adds a "new_node" into the list immediately after "where".
void zap(iterator &where)
wipes out the item at "where", including its contents.
int items_from_tail(const iterator &where) const
Returns the number of elements between the current item and the tail.
void zap_all()
destroys all the list elements and makes the list empty.
void insert(iterator &where, node *new_node)
places a "new_node" immediately before the current node in the list.
bool set_index(iterator &to_set, int new_index)
positions the iterator "to_set" at the index specified.
An object representing the interstitial cell in most linked data structures.