Public Methods | |
| LinkedList () | |
| LinkedList (const LinkedList< T > &list) | |
| ~LinkedList () | |
| void | operator= (LinkedList< T > &list) |
| bool | empty () const |
| long | size () const |
| bool | contains (const T &value) |
| bool | contains (const T &value, iterator &iter) |
| void | clear () |
| bool | erase (iterator iter) |
| bool | erase (iterator iterBegin, iterator iterEnd) |
| bool | remove (const T &value) |
| bool | removeAndCount (const T &value, long &count) |
| bool | push_back_list (LinkedList< T > *list) |
| bool | push_front (const T &value) |
| bool | push_back (const T &value) |
| bool | push_front_unique (const T &value) |
| bool | push_back_unique (const T &value) |
| T | pop_front () |
| T | pop_back () |
| T & | front () |
| T & | back () |
| iterator | begin () |
| iterator | end () |
| iterator * | insertAfter (iterator *iter, const T &value) |
| iterator * | insertBefore (iterator *iter, const T &value) |
A list can only hold values of one type, T, defined when the list is created. For example, the following list:
LinkedList<int> mylist
|
|||||||||
|
Constructor. Initializes an empty list |
|
||||||||||
|
Copy constructor. Initializes the list with a copy of list |
|
|||||||||
|
Destructor, clears the list and frees memory.
|
|
|||||||||
|
Returns the last element of the list (without removing it). If the list is empty, the function fails and calls exit(1)
|
|
|||||||||
|
Returns an iterator pointing to the first element of the list.
|
|
|||||||||
|
Clears the list (removes all elements).
|
|
||||||||||||||||
|
Checks if the given value is found in the list, and if so, returns an iterator pointing to it.
|
|
||||||||||
|
Checks if the given value is found in the list.
|
|
|||||||||
|
Checks if list is empty.
|
|
|||||||||
|
Returns an iterator pointing to a dummy element, which is an element after the last element of the list.
|
|
||||||||||||||||
|
Remove all elements in the list between the element pointed by iterBegin, and the element pointed by iterEnd (including both).
|
|
||||||||||
|
Remove the element pointed by iter.
|
|
|||||||||
|
Returns the first element of the list (without removing it). If the list is empty, the function fails and calls exit(1)
|
|
||||||||||||||||
|
Inserts a new element with the given value to the list, after the element pointed to by iter.
|
|
||||||||||||||||
|
Inserts a new element with the given value to the list, before the element pointed to by iter.
|
|
||||||||||
|
Copies all elements of list to the current list (clears current list first).
|
|
|||||||||
|
Remove the last element of the list and return it. If the list is already empty, the function fails and calls exit(1) (after printing an error message)
|
|
|||||||||
|
Remove the first element of the list and return it. If the list is already empty, the function fails and calls exit(1) (after printing an error message)
|
|
||||||||||
|
Insert a new element with the given value to the end of the list.
|
|
||||||||||
|
Copies the given list at the end of the current list.
|
|
||||||||||
|
Insert a new element with the given value to the end of the list, only if the same value is not already contained in the list.
|
|
||||||||||
|
Insert a new element with the given value to the head of the list.
|
|
||||||||||
|
Insert a new element with the given value to the head of the list, only if the same value is not already contained in the list.
|
|
||||||||||
|
Remove all the elements in the list whose value is equal to the given value.
|
|
||||||||||||||||
|
Remove all the elements in the list whose value is equal to the given value, and count the number of elements removed.
|
|
|||||||||
|
Returns the list size (number of elements in the list).
|