19template<
class TYPE>
class List
48 Iterator
AddAfter(Iterator iter,
const TYPE& e);
72 Iterator
Find(
const TYPE& e, Iterator start)
const;
99 operator bool()
const;
105 friend class List<TYPE>;
162 #if NEBULA_BOUNDSCHECKS
257 this->node = rhs.
node;
269 return (this->node == rhs.
node);
279 return (this->node != rhs.
node);
289 #if NEBULA_BOUNDSCHECKS
292 this->node = this->node->GetNext();
303 #if NEBULA_BOUNDSCHECKS
307 this->node = this->node->GetNext();
318 #if NEBULA_BOUNDSCHECKS
321 this->node = this->node->GetPrev();
332 #if NEBULA_BOUNDSCHECKS
336 this->node = this->node->GetPrev();
346 return (0 != this->node);
356 #if NEBULA_BOUNDSCHECKS
359 return &(this->node->Value());
369 #if NEBULA_BOUNDSCHECKS
372 return this->node->Value();
446 return (0 == this->front);
458 for (iter = this->Begin(); iter != this->End(); ++iter)
486 for (iter = rhs.
Begin(); iter != rhs.
End(); ++iter)
488 this->AddBack(*iter);
502 #if NEBULA_BOUNDSCHECKS
503 n_assert((0 == this->front) && (0 == this->back));
510 if (iter.
GetNode() == this->back)
535 #if NEBULA_BOUNDSCHECKS
536 n_assert((0 == this->front) && (0 == this->back));
543 if (iter.
GetNode() == this->front)
565 return this->AddBefore(this->front, e);
575 return this->AddAfter(this->back, e);
585 #if NEBULA_BOUNDSCHECKS
597 if (node == this->front)
601 if (node == this->back)
607 TYPE elm = node->
Value();
619 #if NEBULA_BOUNDSCHECKS
622 return this->Remove(this->front);
632 #if NEBULA_BOUNDSCHECKS
635 return this->Remove(this->back);
645 #if NEBULA_BOUNDSCHECKS
648 return this->front->Value();
658 #if NEBULA_BOUNDSCHECKS
661 return this->back->Value();
701 for (; start != this->End(); ++start)
the list iterator
Definition list.h:76
Node * node
Definition list.h:110
TYPE * operator->() const
safe -> operator
Definition list.h:354
bool operator!=(const Iterator &rhs) const
inequality operator
Definition list.h:277
bool operator==(const Iterator &rhs) const
equality operator
Definition list.h:267
const Iterator & operator=(const Iterator &rhs)
assignment operator
Definition list.h:253
Iterator()
default constructor
Definition list.h:222
Node * GetNode() const
access to node
Definition list.h:380
const Iterator & operator++()
pre-increment operator
Definition list.h:287
const Iterator & operator--()
pre-decrement operator
Definition list.h:316
TYPE & operator*() const
safe dereference operator
Definition list.h:367
a node in the list
Definition list.h:116
Node * GetPrev() const
get pointer to previous node
Definition list.h:203
Node * next
Definition list.h:135
Node(const TYPE &v)
constructor
Definition list.h:148
Node * GetNext() const
get pointer to next node
Definition list.h:183
Node * prev
Definition list.h:136
~Node()
destructor
Definition list.h:160
void SetNext(Node *n)
set pointer to next node
Definition list.h:173
void SetPrev(Node *p)
set pointer to previous node
Definition list.h:193
TYPE value
Definition list.h:137
TYPE & Value()
get value reference
Definition list.h:213
Implements a doubly linked list.
Definition list.h:20
void operator=(const List< TYPE > &rhs)
assignment operator
Definition list.h:433
void operator=(List< TYPE > &&rhs)
assignment operator
bool IsEmpty() const
return true if the list is empty
Definition list.h:444
Node * back
Definition list.h:141
TYPE & Back() const
get last element
Definition list.h:656
void AddList(const List< TYPE > &l)
add contents of other list to this list
Definition list.h:483
Iterator Find(const TYPE &e, Iterator start) const
find element in array (slow)
Definition list.h:699
Iterator AddBefore(Iterator iter, const TYPE &e)
add element before given element
Definition list.h:530
Iterator AddBack(const TYPE &e)
add element to end of list
Definition list.h:573
Iterator AddAfter(Iterator iter, const TYPE &e)
add element after given element
Definition list.h:497
List(List< TYPE > &&rhs)
move constructor
Definition list.h:411
TYPE RemoveBack()
remove last element of list
Definition list.h:630
void Clear()
clear list
Definition list.h:470
Iterator Begin() const
get iterator to first element
Definition list.h:669
Iterator End() const
get iterator past the last element
Definition list.h:679
Iterator Last() const
get iterator to last element
Definition list.h:689
Iterator AddFront(const TYPE &e)
add element to beginning of list
Definition list.h:563
TYPE Remove(Iterator iter)
remove given element
Definition list.h:583
List()
constructor
Definition list.h:389
Node * front
Definition list.h:140
List(const List< TYPE > &rhs)
copy constructor
Definition list.h:400
TYPE & Front() const
get first element
Definition list.h:643
TYPE RemoveFront()
remove first element of list
Definition list.h:617
SizeT Size() const
get number of elements in list (slow)
Definition list.h:454
~List()
destructor
Definition list.h:423
#define n_assert(exp)
Definition debug.h:50
A pinned array is an array which manages its own virtual memory.
Definition String.cs:6
int SizeT
Definition types.h:49