Nebula
Loading...
Searching...
No Matches
Util::List< TYPE > Class Template Reference

#include <list.h>

Detailed Description

template<class TYPE>
class Util::List< TYPE >

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

Nodefront
 
Nodeback
 

Constructor & Destructor Documentation

◆ List() [1/3]

template<class TYPE >
Util::List< TYPE >::List ( )

constructor

◆ List() [2/3]

template<class TYPE >
Util::List< TYPE >::List ( const List< TYPE > & rhs)

copy constructor

◆ List() [3/3]

template<class TYPE >
Util::List< TYPE >::List ( List< TYPE > && rhs)

move constructor

◆ ~List()

template<class TYPE >
Util::List< TYPE >::~List ( )

destructor

Member Function Documentation

◆ AddAfter()

template<class TYPE >
List< TYPE >::Iterator Util::List< TYPE >::AddAfter ( Iterator iter,
const TYPE & e )

add element after given element

◆ AddBack()

template<class TYPE >
List< TYPE >::Iterator Util::List< TYPE >::AddBack ( const TYPE & e)

add element to end of list

◆ AddBefore()

template<class TYPE >
List< TYPE >::Iterator Util::List< TYPE >::AddBefore ( Iterator iter,
const TYPE & e )

add element before given element

◆ AddFront()

template<class TYPE >
List< TYPE >::Iterator Util::List< TYPE >::AddFront ( const TYPE & e)

add element to beginning of list

◆ AddList()

template<class TYPE >
void Util::List< TYPE >::AddList ( const List< TYPE > & l)

add contents of other list to this list

◆ Back()

template<class TYPE >
TYPE & Util::List< TYPE >::Back ( ) const

get last element

◆ Begin()

template<class TYPE >
List< TYPE >::Iterator Util::List< TYPE >::Begin ( ) const

get iterator to first element

◆ Clear()

template<class TYPE >
void Util::List< TYPE >::Clear ( )

clear list

◆ End()

template<class TYPE >
List< TYPE >::Iterator Util::List< TYPE >::End ( ) const

get iterator past the last element

◆ Find()

template<class TYPE >
List< TYPE >::Iterator Util::List< TYPE >::Find ( const TYPE & e,
Iterator start ) const

find element in array (slow)

◆ Front()

template<class TYPE >
TYPE & Util::List< TYPE >::Front ( ) const

get first element

◆ IsEmpty()

template<class TYPE >
bool Util::List< TYPE >::IsEmpty ( ) const

return true if the list is empty

◆ Last()

template<class TYPE >
List< TYPE >::Iterator Util::List< TYPE >::Last ( ) const

get iterator to last element

◆ operator=() [1/2]

template<class TYPE >
void Util::List< TYPE >::operator= ( const List< TYPE > & rhs)

assignment operator

◆ operator=() [2/2]

template<class TYPE >
void Util::List< TYPE >::operator= ( List< TYPE > && rhs)

assignment operator

◆ Remove()

template<class TYPE >
TYPE Util::List< TYPE >::Remove ( Iterator iter)

remove given element

◆ RemoveBack()

template<class TYPE >
TYPE Util::List< TYPE >::RemoveBack ( )

remove last element of list

◆ RemoveFront()

template<class TYPE >
TYPE Util::List< TYPE >::RemoveFront ( )

remove first element of list

◆ Size()

template<class TYPE >
SizeT Util::List< TYPE >::Size ( ) const

get number of elements in list (slow)

Member Data Documentation

◆ back

template<class TYPE >
Node* Util::List< TYPE >::back
private

◆ front

template<class TYPE >
Node* Util::List< TYPE >::front
private

The documentation for this class was generated from the following file: