at
and operator[]
.
This is a doubly linked list. Traversal up and down the list requires linear time, but adding and removing elements (or nodes) is done in constant time, regardless of where the change takes place. Unlike std::vector and std::deque, random-access iterators are not provided, so subscripting ( [] ) access is not allowed. For algorithms which only need sequential access, this lack makes no difference.
Also unlike the other standard containers, std::list provides specialized algorithms unique to linked lists, such as splicing, sorting, and in-place reversal.
Definition at line 392 of file stl_list.h.
|
Default constructor creates no elements.
Definition at line 458 of file stl_list.h. |
|
Create a list with copies of an exemplar element.
Definition at line 468 of file stl_list.h. |
|
Create a list with default elements.
Definition at line 481 of file stl_list.h. |
|
List copy constructor.
Definition at line 492 of file stl_list.h. References list::begin(), and list::end(). |
|
Builds a list from a range.
Definition at line 511 of file stl_list.h. |
|
Assigns a range to a list.
Note that the assignment completely changes the list and that the resulting list's size is the same as the number of elements assigned. Old data may be lost. Definition at line 562 of file stl_list.h. |
|
Assigns a given value to a list.
Definition at line 545 of file stl_list.h. |
|
Returns a read-only (constant) reference to the data at the last element of the list. Definition at line 724 of file stl_list.h. |
|
Returns a read/write reference to the data at the last element of the list. Definition at line 712 of file stl_list.h. |
|
Returns a read-only (constant) iterator that points to the first element in the list. Iteration is done in ordinary element order. Definition at line 589 of file stl_list.h. |
|
Returns a read/write iterator that points to the first element in the list. Iteration is done in ordinary element order. Definition at line 580 of file stl_list.h. Referenced by list::_M_assign_dispatch(), list::_M_fill_assign(), list::list(), list::merge(), list::operator=(), std::operator==(), list::remove(), list::remove_if(), list::resize(), list::sort(), list::splice(), and list::unique(). |
|
Erases all the elements. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibilty. Definition at line 911 of file stl_list.h. |
|
Returns true if the list is empty. (Thus begin() would equal end().) Definition at line 651 of file stl_list.h. Referenced by list::sort(), and list::splice(). |
|
Returns a read-only (constant) iterator that points one past the last element in the list. Iteration is done in ordinary element order. Definition at line 606 of file stl_list.h. |
|
Returns a read/write iterator that points one past the last element in the list. Iteration is done in ordinary element order. Definition at line 598 of file stl_list.h. Referenced by list::_M_assign_dispatch(), list::_M_fill_assign(), list::list(), list::merge(), list::operator=(), std::operator==(), list::remove(), list::remove_if(), list::resize(), list::splice(), and list::unique(). |
|
Remove a range of elements.
Due to the nature of a list this operation can be done in constant time, and only invalidates iterators/references to the element being removed. The user is also cautioned that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibilty. Definition at line 884 of file stl_list.h. |
|
Remove element at given position.
Due to the nature of a list this operation can be done in constant time, and only invalidates iterators/references to the element being removed. The user is also cautioned that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibilty. Definition at line 95 of file list.tcc. References list::_M_erase(), _List_node_base::_M_next, and _List_iterator::_M_node. Referenced by list::_M_assign_dispatch(), list::_M_fill_assign(), list::operator=(), and list::resize(). |
|
Returns a read-only (constant) reference to the data at the first element of the list. Definition at line 704 of file stl_list.h. |
|
Returns a read/write reference to the data at the first element of the list. Definition at line 696 of file stl_list.h. |
|
Get a copy of the memory allocation object.
Reimplemented from _List_base. Definition at line 571 of file stl_list.h. |
|
Inserts a range into the list.
Due to the nature of a list this operation can be done in constant time, and does not invalidate iterators and references. Definition at line 838 of file stl_list.h. |
|
Inserts a number of copies of given data into the list.
Due to the nature of a list this operation can be done in constant time, and does not invalidate iterators and references. Definition at line 819 of file stl_list.h. |
|
Inserts given value into list before specified iterator.
Definition at line 85 of file list.tcc. References list::_M_create_node(), _List_iterator::_M_node, and _List_node_base::hook(). Referenced by list::_M_assign_dispatch(), list::_M_fill_assign(), list::operator=(), and list::resize(). |
|
Returns the size() of the largest possible list. Definition at line 661 of file stl_list.h. |
|
Merge sorted lists according to comparison function.
Definition at line 315 of file list.tcc. References list::_M_transfer(), list::begin(), and list::end(). |
|
Merge sorted lists.
Definition at line 211 of file list.tcc. References list::_M_transfer(), list::begin(), and list::end(). Referenced by list::sort(). |
|
List assignment operator.
Definition at line 120 of file list.tcc. References list::begin(), list::end(), list::erase(), and list::insert(). |
|
Removes last element. This is a typical stack operation. It shrinks the list by one. Due to the nature of a list this operation can be done in constant time, and only invalidates iterators/references to the element being removed. Note that no data is returned, and if the last element's data is needed, it should be retrieved before pop_back() is called. Definition at line 788 of file stl_list.h. |
|
Removes first element. This is a typical stack operation. It shrinks the list by one. Due to the nature of a list this operation can be done in constant time, and only invalidates iterators/references to the element being removed. Note that no data is returned, and if the first element's data is needed, it should be retrieved before pop_front() is called. Definition at line 759 of file stl_list.h. |
|
Add data to the end of the list.
Definition at line 773 of file stl_list.h. |
|
Add data to the front of the list.
Definition at line 743 of file stl_list.h. |
|
Returns a read-only (constant) reverse iterator that points to the last element in the list. Iteration is done in reverse element order. Definition at line 624 of file stl_list.h. |
|
Returns a read/write reverse iterator that points to the last element in the list. Iteration is done in reverse element order. Definition at line 615 of file stl_list.h. |
|
Remove all elements equal to value.
Definition at line 174 of file list.tcc. References list::_M_erase(), list::begin(), and list::end(). |
|
Remove all elements satisfying a predicate.
Definition at line 276 of file list.tcc. References list::_M_erase(), list::begin(), and list::end(). |
|
Returns a read-only (constant) reverse iterator that points to one before the first element in the list. Iteration is done in reverse element order. Definition at line 642 of file stl_list.h. |
|
Returns a read/write reverse iterator that points to one before the first element in the list. Iteration is done in reverse element order. Definition at line 633 of file stl_list.h. |
|
Resizes the list to the specified number of elements.
Definition at line 687 of file stl_list.h. |
|
Resizes the list to the specified number of elements.
Definition at line 105 of file list.tcc. References list::begin(), list::end(), list::erase(), and list::insert(). |
|
Reverse the elements in list. Reverse the order of elements in the list in linear time. Definition at line 1064 of file stl_list.h. |
|
Returns the number of elements in the list. Definition at line 656 of file stl_list.h. References std::distance(). |
|
Sort the elements according to comparison function. Sorts the elements of this list in NlogN time. Equivalent elements remain in list order. Definition at line 343 of file list.tcc. References list::begin(), list::empty(), list::merge(), list::splice(), and list::swap(). |
|
Sort the elements. Sorts the elements of this list in NlogN time. Equivalent elements remain in list order. Definition at line 238 of file list.tcc. References list::begin(), list::empty(), list::merge(), list::splice(), and list::swap(). |
|
Insert range from another list.
Undefined if position is in [first,last). Definition at line 966 of file stl_list.h. |
|
Insert element from another list.
Definition at line 944 of file stl_list.h. |
|
Insert contents of another list.
Definition at line 928 of file stl_list.h. References list::begin(), list::empty(), and list::end(). Referenced by list::sort(). |
|
Swaps data with another list.
Definition at line 901 of file stl_list.h. References _List_base::_M_impl, and std::swap(). Referenced by list::sort(), and std::swap(). |
|
Remove consecutive elements satisfying a predicate.
Definition at line 294 of file list.tcc. References list::_M_erase(), list::begin(), and list::end(). |
|
Remove consecutive duplicate elements. For each consecutive set of elements with the same value, remove all but the first one. Remaining elements stay in list order. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibilty. Definition at line 191 of file list.tcc. References list::_M_erase(), list::begin(), and list::end(). |