#include <rtlist.h>
Public Methods | |
| List () | |
| Creates an empty list. | |
| List (const List< T > &) | |
| Creates a new list which contains a copy of all entries of the given list. | |
| List< T > & | operator= (const List< T > &) |
| Clears the list, then copies all the entries from the given list over to this one. | |
| ~List () | |
| Destroys the list and all of its elements. | |
| T & | append (const T &elem) |
| Append an element to the list. More... | |
| T & | prepend (const T &elem) |
| Prepend an element to the list. More... | |
| T & | insertBefore (Iterator< T > &pos, const T &elem) |
| Insert an element before the given position. More... | |
| T & | insertAfter (Iterator< T > &pos, const T &elem) |
| Insert an element after the given position. More... | |
| void | remove (Iterator< T > &pos) |
| Remove an element from the list. More... | |
| Node * | remove (Node *element) |
| Remove an element from the list. More... | |
| void | clear () |
| Remove all elements from the list, and destroy them. | |
| int | length () const |
| Returns the current element count of the list. | |
| int | getSize () const |
| Returns the current element count of the list. | |
| Node * | first () |
| const Node * | first () const |
| Node * | last () |
| const Node * | last () const |
| Iterator< T > | begin () const |
| Returns an unmodifyable iterator to the first element of the list. More... | |
| Iterator< T > | end () const |
| Returns an unmodifyable iterator to the last element of the list. More... | |
| Iterator< T > | begin () |
| Returns an modifyable iterator to the first element of the list. More... | |
| Iterator< T > | end () |
| Returns an modifyable iterator to the last element of the list. More... | |
Friends | |
| class | IteratorImpl |
As opposed to Vectors, elements can be inserted and removed very quickly into lists, and sequential access to elements (forwards and backwards) is quick, too. (The class Iterator is used for this.) However, random access to elements is quite slow.
|
||||||||||
|
Append an element to the list.
|
|
|||||||||
|
Returns an modifyable iterator to the first element of the list. If the list is empty, the iterator points to nothing; you can use Iterator::hasElement() to check this. |
|
|||||||||
|
Returns an unmodifyable iterator to the first element of the list. If the list is empty, the iterator points to nothing; you can use Iterator::hasElement() to check this. |
|
|||||||||
|
Returns an modifyable iterator to the last element of the list. If the list is empty, the iterator points to nothing; you can use Iterator::hasElement() to check this. |
|
|||||||||
|
Returns an unmodifyable iterator to the last element of the list. If the list is empty, the iterator points to nothing; you can use Iterator::hasElement() to check this. |
|
||||||||||||||||
|
Insert an element after the given position.
|
|
||||||||||||||||
|
Insert an element before the given position.
|
|
||||||||||
|
Prepend an element to the list.
|
|
||||||||||
|
Remove an element from the list. Returns a pointer to the next element of the list. |
|
||||||||||
|
Remove an element from the list. Moves the iterator to the next element of the list. |