5 #ifndef __IRR_LIST_H_INCLUDED__
6 #define __IRR_LIST_H_INCLUDED__
27 SKListNode(
const T& e) : Next(0), Prev(0), Element(e) {}
52 while (num-- && this->Current != 0) ++(*this);
56 while(num++ && this->Current != 0) --(*this);
70 #if defined (_MSC_VER) && (_MSC_VER < 1300)
71 #pragma warning(disable:4284) // infix notation problem when using iterator operator ->
103 while(num-- && this->Current != 0) ++(*this);
107 while(num++ && this->Current != 0) --(*this);
137 : First(0), Last(0), Size(0) {}
164 SKListNode* node = other.First;
191 SKListNode * next = First->Next;
215 SKListNode* node = allocator.
allocate(1);
236 SKListNode* node = allocator.
allocate(1);
259 return Iterator(First);
267 return ConstIterator(First);
283 return ConstIterator(0);
291 return Iterator(Last);
299 return ConstIterator(Last);
310 SKListNode* node = allocator.
allocate(1);
313 node->Next = it.Current->Next;
315 if (it.Current->Next)
316 it.Current->Next->Prev = node;
318 node->Prev = it.Current;
319 it.Current->Next = node;
322 if (it.Current == Last)
334 SKListNode* node = allocator.
allocate(1);
337 node->Prev = it.Current->Prev;
339 if (it.Current->Prev)
340 it.Current->Prev->Next = node;
342 node->Next = it.Current;
343 it.Current->Prev = node;
346 if (it.Current == First)
359 Iterator returnIterator(it);
362 if(it.Current == First)
364 First = it.Current->Next;
368 it.Current->Prev->Next = it.Current->Next;
371 if(it.Current == Last)
373 Last = it.Current->Prev;
377 it.Current->Next->Prev = it.Current->Prev;
385 return returnIterator;
ConstIterator & operator-=(s32 num)
void insert_after(const Iterator &it, const T &element)
Inserts an element after an element.
ConstIterator end() const
Gets end node.
ConstIterator(const Iterator &iter)
Iterator getLast()
Gets last element.
Iterator & operator+=(s32 num)
void destruct(T *ptr)
Destruct an element.
ConstIterator getLast() const
Gets last element.
Iterator operator+(s32 num) const
Doubly linked list template.
List iterator for const access.
list(const list< T > &other)
Copy constructor.
signed int s32
32 bit signed variable.
void push_back(const T &element)
Adds an element at the end of the list.
unsigned int u32
32 bit unsigned variable.
void push_front(const T &element)
Adds an element at the begin of the list.
void operator=(const list< T > &other)
Assignment operator.
u32 size() const
Returns amount of elements in list.
Iterator & operator-=(s32 num)
T * allocate(size_t cnt)
Allocate memory for an array of objects.
void swap(list< T > &other)
Swap the content of this list container with the content of another list.
void swap(T1 &a, T2 &b)
swaps the content of the passed parameters
void clear()
Clears the list, deletes all elements in the list.
ConstIterator & operator++()
Iterator erase(Iterator &it)
Erases an element.
bool operator==(const ConstIterator &other) const
void construct(T *ptr, const T &e)
Construct an element.
ConstIterator & operator+=(s32 num)
bool empty() const
Checks for empty list.
ConstIterator & operator=(const Iterator &iterator)
Iterator operator-(s32 num) const
Iterator end()
Gets end node.
bool operator==(const Iterator &other) const
ConstIterator & operator--()
ConstIterator operator-(s32 num) const
ConstIterator operator+(s32 num) const
void deallocate(T *ptr)
Deallocate memory for an array of objects.
bool operator!=(const Iterator &other) const
Iterator begin()
Gets first node.
void insert_before(const Iterator &it, const T &element)
Inserts an element before an element.
ConstIterator begin() const
Gets first node.
bool operator!=(const ConstIterator &other) const
list()
Default constructor for empty list.