feisty meow concerns codebase
2.140
|
Implements a singly-linked list structure. More...
#include <singly_linked_list.h>
Public Member Functions | |
singly_linked_list () | |
~singly_linked_list () | |
int | elements () const |
returns the number of items currently in the list, including this node. More... | |
singly_linked_list * | next () |
void | set_next (singly_linked_list *new_next) |
Public Member Functions inherited from nodes::node | |
node (int number_of_links=0) | |
the constructor provides for "number_of_links" links initially. More... | |
virtual | ~node () |
the destructor simply invalidates the node. More... | |
int | links () const |
Returns the number of links the node currently holds. More... | |
void | set_link (int link_number, node *new_link) |
Connects the node "new_link" to this node. More... | |
node * | get_link (int link_number) const |
Returns the node that is connected to the specified "link_number". More... | |
void | zap_link (int link_number) |
the specified link is removed from the node. More... | |
void | insert_link (int where, node *to_add=NULL_POINTER) |
adds a new link prior to the position specified in "where". More... | |
int | which (node *to_find) const |
locates the index where "to_find" lives in our list of links. More... | |
Static Public Member Functions | |
static bool | has_cycle (singly_linked_list *check) |
returns true if this list has a cycle in it. More... | |
Static Public Attributes | |
static const int | NEXT_NODE = 0 |
Implements a singly-linked list structure.
Definition at line 23 of file singly_linked_list.h.
|
inline |
Definition at line 26 of file singly_linked_list.h.
|
inline |
Definition at line 29 of file singly_linked_list.h.
int nodes::singly_linked_list::elements | ( | ) | const |
returns the number of items currently in the list, including this node.
this is a costly operation.
|
inlinestatic |
returns true if this list has a cycle in it.
Definition at line 43 of file singly_linked_list.h.
References next(), and NULL_POINTER.
|
inline |
Definition at line 38 of file singly_linked_list.h.
References nodes::node::get_link(), and NEXT_NODE.
Referenced by has_cycle().
|
inline |
Definition at line 40 of file singly_linked_list.h.
References NEXT_NODE, and nodes::node::set_link().
|
static |
Definition at line 32 of file singly_linked_list.h.
Referenced by next(), and set_next().