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)
103 while(num-- && this->Current != 0) ++(*this);
107 while(num++ && this->Current != 0) --(*this);
132 friend class list<T>;
137 : First(0), Last(0), Size(0) {}
164 SKListNode* node = other.First;
191 SKListNode * next = First->Next;
192 allocator.destruct(First);
193 allocator.deallocate(First);
215 SKListNode* node = allocator.allocate(1);
216 allocator.construct(node, element);
236 SKListNode* node = allocator.allocate(1);
237 allocator.construct(node, element);
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);
311 allocator.construct(node, element);
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);
335 allocator.construct(node, element);
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;
380 allocator.destruct(it.Current);
381 allocator.deallocate(it.Current);
385 return returnIterator;
Very simple allocator implementation, containers using it can be used across dll boundaries.
List iterator for const access.
ConstIterator & operator++()
ConstIterator & operator-=(s32 num)
ConstIterator & operator--()
bool operator!=(const ConstIterator &other) const
ConstIterator & operator=(const Iterator &iterator)
ConstIterator operator-(s32 num) const
bool operator==(const ConstIterator &other) const
ConstIterator & operator+=(s32 num)
ConstIterator operator+(s32 num) const
ConstIterator(const Iterator &iter)
Iterator operator+(s32 num) const
friend class ConstIterator
bool operator==(const Iterator &other) const
Iterator & operator-=(s32 num)
Iterator operator-(s32 num) const
bool operator!=(const Iterator &other) const
Iterator & operator+=(s32 num)
void push_back(const T &element)
Adds an element at the end of the list.
list(const list< T > &other)
Copy constructor.
void insert_before(const Iterator &it, const T &element)
Inserts an element before an element.
u32 size() const
Returns amount of elements in list.
Iterator erase(Iterator &it)
Erases an element.
void operator=(const list< T > &other)
Assignment operator.
ConstIterator end() const
Gets end node.
Iterator getLast()
Gets last element.
ConstIterator getLast() const
Gets last element.
void swap(list< T > &other)
Swap the content of this list container with the content of another list.
ConstIterator begin() const
Gets first node.
bool empty() const
Checks for empty list.
void insert_after(const Iterator &it, const T &element)
Inserts an element after an element.
list()
Default constructor for empty list.
Iterator end()
Gets end node.
void clear()
Clears the list, deletes all elements in the list.
Iterator begin()
Gets first node.
void push_front(const T &element)
Adds an element at the begin of the list.
Basic classes such as vectors, planes, arrays, lists, and so on can be found in this namespace.
void swap(T1 &a, T2 &b)
swaps the content of the passed parameters
Everything in the Irrlicht Engine can be found in this namespace.
unsigned int u32
32 bit unsigned variable.
signed int s32
32 bit signed variable.