Nebula
|
#include <list.h>
Implements a doubly linked list.
Since list elements can be all over the place in memory, dynamic arrays are often the better choice, unless insert/remove performance is more important then traversal performance.
Classes | |
class | Iterator |
the list iterator More... | |
class | Node |
a node in the list More... | |
Public Member Functions | |
List () | |
constructor | |
List (const List< TYPE > &rhs) | |
copy constructor | |
List (List< TYPE > &&rhs) | |
move constructor | |
~List () | |
destructor | |
void | operator= (const List< TYPE > &rhs) |
assignment operator | |
void | operator= (List< TYPE > &&rhs) |
assignment operator | |
bool | IsEmpty () const |
return true if the list is empty | |
SizeT | Size () const |
get number of elements in list (slow) | |
void | Clear () |
clear list | |
void | AddList (const List< TYPE > &l) |
add contents of other list to this list | |
Iterator | AddAfter (Iterator iter, const TYPE &e) |
add element after given element | |
Iterator | AddBefore (Iterator iter, const TYPE &e) |
add element before given element | |
Iterator | AddFront (const TYPE &e) |
add element to beginning of list | |
Iterator | AddBack (const TYPE &e) |
add element to end of list | |
TYPE | RemoveFront () |
remove first element of list | |
TYPE | RemoveBack () |
remove last element of list | |
TYPE | Remove (Iterator iter) |
remove given element | |
TYPE & | Front () const |
get first element | |
TYPE & | Back () const |
get last element | |
Iterator | Begin () const |
get iterator to first element | |
Iterator | End () const |
get iterator past the last element | |
Iterator | Last () const |
get iterator to last element | |
Iterator | Find (const TYPE &e, Iterator start) const |
find element in array (slow) | |
Private Attributes | |
Node * | front |
Node * | back |
Util::List< TYPE >::List | ( | ) |
constructor
Util::List< TYPE >::List | ( | const List< TYPE > & | rhs | ) |
copy constructor
Util::List< TYPE >::List | ( | List< TYPE > && | rhs | ) |
move constructor
Util::List< TYPE >::~List | ( | ) |
destructor
List< TYPE >::Iterator Util::List< TYPE >::AddAfter | ( | Iterator | iter, |
const TYPE & | e ) |
add element after given element
List< TYPE >::Iterator Util::List< TYPE >::AddBack | ( | const TYPE & | e | ) |
add element to end of list
List< TYPE >::Iterator Util::List< TYPE >::AddBefore | ( | Iterator | iter, |
const TYPE & | e ) |
add element before given element
List< TYPE >::Iterator Util::List< TYPE >::AddFront | ( | const TYPE & | e | ) |
add element to beginning of list
void Util::List< TYPE >::AddList | ( | const List< TYPE > & | l | ) |
add contents of other list to this list
TYPE & Util::List< TYPE >::Back | ( | ) | const |
get last element
List< TYPE >::Iterator Util::List< TYPE >::Begin | ( | ) | const |
get iterator to first element
void Util::List< TYPE >::Clear | ( | ) |
clear list
List< TYPE >::Iterator Util::List< TYPE >::End | ( | ) | const |
get iterator past the last element
List< TYPE >::Iterator Util::List< TYPE >::Find | ( | const TYPE & | e, |
Iterator | start ) const |
find element in array (slow)
TYPE & Util::List< TYPE >::Front | ( | ) | const |
get first element
bool Util::List< TYPE >::IsEmpty | ( | ) | const |
return true if the list is empty
List< TYPE >::Iterator Util::List< TYPE >::Last | ( | ) | const |
get iterator to last element
void Util::List< TYPE >::operator= | ( | const List< TYPE > & | rhs | ) |
assignment operator
void Util::List< TYPE >::operator= | ( | List< TYPE > && | rhs | ) |
assignment operator
TYPE Util::List< TYPE >::Remove | ( | Iterator | iter | ) |
remove given element
TYPE Util::List< TYPE >::RemoveBack | ( | ) |
remove last element of list
TYPE Util::List< TYPE >::RemoveFront | ( | ) |
remove first element of list
SizeT Util::List< TYPE >::Size | ( | ) | const |
get number of elements in list (slow)
|
private |
|
private |