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 407 of file stl_list.h.
|
Default constructor creates no elements.
Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 472 of file stl_list.h. |
|
Create a list with copies of an exemplar element.
Definition at line 483 of file stl_list.h. |
|
List copy constructor.
Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 495 of file stl_list.h. |
|
Builds a list from a range.
Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 509 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. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 564 of file stl_list.h. |
|
Assigns a given value to a list.
Definition at line 547 of file stl_list.h. |
|
Returns a read-only (constant) reference to the data at the last element of the list. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 714 of file stl_list.h. |
|
Returns a read/write reference to the data at the last element of the list. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 702 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. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 591 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. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 582 of file stl_list.h. Referenced by std::list< _Tp, _Alloc >::_M_assign_dispatch(), std::list< _Tp, _Alloc >::_M_fill_assign(), std::list< _Tp, _Allocator >::list(), std::list< _Tp, _Alloc >::merge(), std::list< _Tp, _Alloc >::operator=(), std::operator==(), std::list< _Tp, _Alloc >::remove(), std::list< _Tp, _Alloc >::remove_if(), std::list< _Tp, _Alloc >::resize(), std::list< _Tp, _Alloc >::sort(), std::list< _Tp, _Allocator >::splice(), and std::list< _Tp, _Alloc >::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. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 907 of file stl_list.h. |
|
Returns true if the list is empty. (Thus begin() would equal end().) Definition at line 654 of file stl_list.h. Referenced by std::list< _Tp, _Alloc >::sort(), and std::list< _Tp, _Allocator >::splice(). |
|
Returns a read-only (constant) iterator that points one past the last element in the list. Iteration is done in ordinary element order. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 609 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. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 600 of file stl_list.h. Referenced by std::list< _Tp, _Alloc >::_M_assign_dispatch(), std::list< _Tp, _Alloc >::_M_fill_assign(), std::list< _Tp, _Allocator >::list(), std::list< _Tp, _Alloc >::merge(), std::list< _Tp, _Alloc >::operator=(), std::operator==(), std::list< _Tp, _Alloc >::remove(), std::list< _Tp, _Alloc >::remove_if(), std::list< _Tp, _Alloc >::resize(), std::list< _Tp, _Allocator >::splice(), and std::list< _Tp, _Alloc >::unique(). |
|
Remove a range of elements.
This operation is linear time in the size of the range 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 873 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 96 of file list.tcc. References std::list< _Tp, _Alloc >::_M_erase(), std::_List_node_base::_M_next, and std::_List_iterator< _Tp >::_M_node. Referenced by std::list< _Tp, _Alloc >::_M_assign_dispatch(), std::list< _Tp, _Alloc >::_M_fill_assign(), std::list< _Tp, _Alloc >::operator=(), and std::list< _Tp, _Alloc >::resize(). |
|
Returns a read-only (constant) reference to the data at the first element of the list. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 694 of file stl_list.h. |
|
Returns a read/write reference to the data at the first element of the list. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 686 of file stl_list.h. |
|
Get a copy of the memory allocation object.
Reimplemented from std::_List_base< _Tp, _Alloc >. Definition at line 573 of file stl_list.h. |
|
Inserts a range into the list.
This operation is linear in the number of elements inserted and does not invalidate iterators and references. Definition at line 829 of file stl_list.h. |
|
Inserts a number of copies of given data into the list.
This operation is linear in the number of elements inserted and does not invalidate iterators and references. Definition at line 808 of file stl_list.h. |
|
Inserts given value into list before specified iterator.
Definition at line 86 of file list.tcc. References std::list< _Tp, _Alloc >::_M_create_node(), std::_List_iterator< _Tp >::_M_node, and std::_List_node_base::hook(). Referenced by std::list< _Tp, _Alloc >::_M_assign_dispatch(), std::list< _Tp, _Alloc >::_M_fill_assign(), std::list< _Tp, _Alloc >::operator=(), and std::list< _Tp, _Alloc >::resize(). |
|
Returns the size() of the largest possible list. Definition at line 664 of file stl_list.h. |
|
Merge sorted lists according to comparison function.
Definition at line 242 of file list.tcc. References std::list< _Tp, _Alloc >::_M_check_equal_allocators(), std::list< _Tp, _Alloc >::_M_transfer(), std::list< _Tp, _Alloc >::begin(), and std::list< _Tp, _Alloc >::end(). |
|
Merge sorted lists.
Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 212 of file list.tcc. References std::list< _Tp, _Alloc >::_M_check_equal_allocators(), std::list< _Tp, _Alloc >::_M_transfer(), std::list< _Tp, _Alloc >::begin(), and std::list< _Tp, _Alloc >::end(). Referenced by std::list< _Tp, _Alloc >::sort(). |
|
List assignment operator.
Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 121 of file list.tcc. References std::list< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::end(), std::list< _Tp, _Alloc >::erase(), and std::list< _Tp, _Alloc >::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. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 778 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. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 749 of file stl_list.h. |
|
Add data to the end of the list.
Definition at line 763 of file stl_list.h. |
|
Add data to the front of the list.
Definition at line 733 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. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 627 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. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 618 of file stl_list.h. |
|
Remove all elements equal to value.
Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 175 of file list.tcc. References std::list< _Tp, _Alloc >::_M_erase(), std::list< _Tp, _Alloc >::begin(), and std::list< _Tp, _Alloc >::end(). |
|
Remove all elements satisfying a predicate.
Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 309 of file list.tcc. References std::list< _Tp, _Alloc >::_M_erase(), std::list< _Tp, _Alloc >::begin(), and std::list< _Tp, _Alloc >::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. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 645 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. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 636 of file stl_list.h. |
|
Resizes the list to the specified number of elements.
Definition at line 106 of file list.tcc. References std::list< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::end(), std::list< _Tp, _Alloc >::erase(), and std::list< _Tp, _Alloc >::insert(). |
|
Reverse the elements in list. Reverse the order of elements in the list in linear time. Definition at line 1075 of file stl_list.h. |
|
Returns the number of elements in the list. Definition at line 659 of file stl_list.h. |
|
Sort the elements according to comparison function. Sorts the elements of this list in NlogN time. Equivalent elements remain in list order. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 348 of file list.tcc. References std::list< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::empty(), std::list< _Tp, _Alloc >::merge(), std::list< _Tp, _Alloc >::splice(), and std::list< _Tp, _Alloc >::swap(). |
|
Sort the elements. Sorts the elements of this list in NlogN time. Equivalent elements remain in list order. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 271 of file list.tcc. References std::list< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::empty(), std::list< _Tp, _Alloc >::merge(), std::list< _Tp, _Alloc >::splice(), and std::list< _Tp, _Alloc >::swap(). |
|
Insert range from another list.
Undefined if position is in [first,last). Definition at line 972 of file stl_list.h. |
|
Insert element from another list.
Definition at line 946 of file stl_list.h. |
|
Insert contents of another list.
Requires this != x. Definition at line 926 of file stl_list.h. Referenced by std::list< _Tp, _Alloc >::sort(). |
|
Swaps data with another list.
Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 890 of file stl_list.h. Referenced by std::list< _Tp, _Alloc >::sort(), and std::swap(). |
|
Remove consecutive elements satisfying a predicate.
Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 327 of file list.tcc. References std::list< _Tp, _Alloc >::_M_erase(), std::list< _Tp, _Alloc >::begin(), and std::list< _Tp, _Alloc >::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. Reimplemented in std::__debug::list< _Tp, _Allocator >. Definition at line 192 of file list.tcc. References std::list< _Tp, _Alloc >::_M_erase(), std::list< _Tp, _Alloc >::begin(), and std::list< _Tp, _Alloc >::end(). |