# std::__debug::list< _Tp, _Allocator > Class Template Reference

Inheritance diagram for std::__debug::list< _Tp, _Allocator >:

List of all members.

## Detailed Description

### template<typename _Tp, typename _Allocator = std::allocator<_Tp>>
class std::__debug::list< _Tp, _Allocator >

Definition at line 75 of file debug/list.

## Public Types

- typedef _Allocator allocator_type
- typedef __gnu_debug::_Safe_iterator<
  typename _Base::const_iterator,
  list > const_iterator
- typedef _Base::const_pointer const_pointer
- typedef _Base::const_reference const_reference
- typedef std::reverse_iterator<
  const_iterator > const_reverse_iterator
- typedef _Base::difference_type difference_type
- typedef __gnu_debug::_Safe_iterator<
  typename _Base::iterator,
  list > iterator
- typedef _Base::pointer pointer
- typedef _Base::reference reference
- typedef std::reverse_iterator<
  iterator > reverse_iterator
- typedef _Base::size_type size_type
- typedef _Tp value_type

## Public Member Functions

- const _Base & _M_base () const
- _Base & _M_base ()
- void _M_invalidate_all () const
- template<typename _Predicate> void _M_invalidate_if (_Predicate __pred)
- template<typename _Iterator> void _M_transfer_iter (const _Safe_iterator< _Iterator, _Sequence > &__x)
- void assign (size_type __n, const _Tp &__t)
- template<class _InputIterator> void assign (_InputIterator __first, _InputIterator __last)
- const_reference back () const
- reference back ()
- const_iterator begin () const
- iterator begin ()
- void clear ()
- bool empty () const
- const_iterator end () const
- iterator end ()
- iterator erase (iterator __first, iterator __last)
- iterator erase (iterator __position)
- iterator erase (iterator __position, iterator __last)
- iterator erase (iterator __position)
- const_reference front () const
- reference front ()
- allocator_type get_allocator () const
- void insert (iterator __position, _InputIterator __first, _InputIterator __last)
- void insert (iterator __position, size_type __n, const value_type &__x)
- iterator insert (iterator __position, const value_type &__x)
- template<class _InputIterator> void insert (iterator __position, _InputIterator __first, _InputIterator __last)
- void insert (iterator __position, size_type __n, const _Tp &__x)
- iterator insert (iterator __position, const _Tp &__x)
- list (const _Base &__x)
- list (const list &__x)
- template<class _InputIterator> list (_InputIterator __first, _InputIterator __last, const _Allocator &__a=_Allocator())
- list (size_type __n, const _Tp &__value=_Tp(), const _Allocator &__a=_Allocator())
- list (const _Allocator &__a=_Allocator())
- size_type max_size () const
- void merge (list &, _StrictWeakOrdering)
- void merge (list &__x)
- template<class _Compare> void merge (list &__x, _Compare __comp)
- void merge (list &__x)
- list & operator= (const list &__x)
- void pop_back ()
- void pop_front ()
- void push_back (const value_type &__x)
- void push_front (const value_type &__x)
- const_reverse_iterator rbegin () const
- reverse_iterator rbegin ()
- void remove (const _Tp &__value)
- template<class _Predicate> void remove_if (_Predicate __pred)
- const_reverse_iterator rend () const
- reverse_iterator rend ()
- void resize (size_type __sz, _Tp __c=_Tp())
- void reverse ()
- size_type size () const
- template<typename _StrictWeakOrdering> void sort (_StrictWeakOrdering __pred)
- void sort ()
- void splice (iterator __position, list &__x, iterator __first, iterator __last)
- void splice (iterator __position, list &__x, iterator __i)
- void splice (iterator __position, list &__x)
- void splice (iterator __position, list &__x, iterator __first, iterator __last)
- void splice (iterator __position, list &__x, iterator __i)
- void splice (iterator __position, list &__x)
- void swap (list &__x)
- void swap (list &__x)
- template<class _BinaryPredicate> void unique (_BinaryPredicate __binary_pred)
- void unique ()
- ~list ()

## Public Attributes

- _Safe_iterator_base * _M_const_iterators
- _Safe_iterator_base * _M_iterators
- unsigned int _M_version

## Protected Types

- typedef _List_node< _Tp > _Node
- typedef _Allocator::template
  rebind< _List_node< _Tp
  > >::other _Node_alloc_type

## Protected Member Functions

- void _M_assign_dispatch (_InputIterator __first, _InputIterator __last, __false_type)
- void _M_assign_dispatch (_Integer __n, _Integer __val, __true_type)
- void _M_check_equal_allocators (list &__x)
- void _M_clear ()
- _Node * _M_create_node (const value_type &__x)
- void _M_detach_all ()
- void _M_detach_singular ()
- void _M_erase (iterator __position)
- void _M_fill_assign (size_type __n, const value_type &__val)
- void _M_fill_initialize (size_type __n, const value_type &__x)
- __gnu_cxx::__mutex & _M_get_mutex ()
- _List_node< _Tp > * _M_get_node ()
- const _Node_alloc_type & _M_get_Node_allocator () const
- _Node_alloc_type & _M_get_Node_allocator ()
- _Tp_alloc_type _M_get_Tp_allocator () const
- void _M_init ()
- void _M_initialize_dispatch (_InputIterator __first, _InputIterator __last, __false_type)
- void _M_initialize_dispatch (_Integer __n, _Integer __x, __true_type)
- void _M_insert (iterator __position, const value_type &__x)
- void _M_put_node (_List_node< _Tp > *__p)
- void _M_revalidate_singular ()
- void _M_swap (_Safe_sequence_base &__x)
- void _M_transfer (iterator __position, iterator __first, iterator __last)

## Protected Attributes

- _List_impl _M_impl

## Constructor & Destructor Documentation

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

std::__debug::list< _Tp, _Allocator >::list | ( | const _Allocator & | __a = `_Allocator()` | ) | `[inline, explicit]`

Default constructor creates no elements.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 102 of file debug/list.

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

std::__debug::list< _Tp, _Allocator >::list | ( | size_type | __n,
|  | const _Tp & | __value = `_Tp()`,
|  | const _Allocator & | __a = `_Allocator()` |
| ) |  |  | `[inline, explicit]`

Create a list with copies of an exemplar element.

Parameters:

  | n | The number of elements to initially create.
  | value | An element to copy.

This constructor fills the list with n copies of value.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 105 of file debug/list.

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>
template<class _InputIterator>

std::__debug::list< _Tp, _Allocator >::list | ( | _InputIterator | __first,
|  | _InputIterator | __last,
|  | const _Allocator & | __a = `_Allocator()` |
| ) |  |  | `[inline]`

Builds a list from a range.

Parameters:

  | first | An input iterator.
  | last | An input iterator.

Create a list consisting of copies of the elements from [first,last). This is linear in N (where N is distance(first,last)).

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 110 of file debug/list.

## Member Function Documentation

void __gnu_debug::_Safe_sequence_base::_M_detach_all | ( |  | ) | `[protected, inherited]`

Detach all iterators, leaving them singular.

Referenced by __gnu_debug::_Safe_sequence_base::~_Safe_sequence_base().

void __gnu_debug::_Safe_sequence_base::_M_detach_singular | ( |  | ) | `[protected, inherited]`

Detach all singular iterators.

Postcondition:
  for all iterators i attached to this sequence, i->_M_version == _M_version.

Referenced by std::__debug::deque< _Tp, _Allocator >::erase(), and std::__debug::list< _Tp, _Allocator >::resize().

__gnu_cxx::__mutex& __gnu_debug::_Safe_sequence_base::_M_get_mutex | ( |  | ) | `[protected, inherited]`

For use in _Safe_sequence.

void __gnu_debug::_Safe_sequence_base::_M_invalidate_all | ( |  | ) | const`[inline, inherited]`

Invalidates all iterators.

Definition at line 220 of file safe_base.h.

References __gnu_debug::_Safe_sequence_base::_M_version.

Referenced by __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::append(), std::__debug::vector< _Tp, _Allocator >::assign(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::assign(), std::__debug::deque< _Tp, _Allocator >::assign(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::c_str(), std::__debug::vector< _Tp, _Allocator >::clear(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::clear(), std::__debug::deque< _Tp, _Allocator >::clear(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::data(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::erase(), std::__debug::deque< _Tp, _Allocator >::erase(), __gnu_debug::getline(), std::__debug::vector< _Tp, _Allocator >::insert(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::insert(), std::__debug::deque< _Tp, _Allocator >::insert(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::operator+=(), std::__debug::vector< _Tp, _Allocator >::operator=(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::operator=(), std::__debug::deque< _Tp, _Allocator >::operator=(), __gnu_debug::operator>>(), std::__debug::vector< _Tp, _Allocator >::push_back(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::push_back(), std::__debug::deque< _Tp, _Allocator >::push_back(), std::__debug::deque< _Tp, _Allocator >::push_front(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::replace(), std::__debug::vector< _Tp, _Allocator >::reserve(), std::__debug::vector< _Tp, _Allocator >::resize(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::resize(), std::__debug::deque< _Tp, _Allocator >::resize(), and __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::swap().

template<typename _Sequence>
template<typename _Predicate>

void __gnu_debug::_Safe_sequence< _Sequence >::_M_invalidate_if | ( | _Predicate | __pred | ) | `[inherited]`

Invalidates all iterators `x` that reference this sequence, are not singular, and for which `pred(x)` returns `true`. The user of this routine should be careful not to make copies of the iterators passed to `pred`, as the copies may interfere with the invalidation.

Definition at line 126 of file safe_sequence.h.

References __gnu_debug::_Safe_sequence_base::_M_const_iterators, and __gnu_debug::_Safe_sequence_base::_M_iterators.

Referenced by std::__debug::vector< _Tp, _Allocator >::erase(), std::__debug::vector< _Tp, _Allocator >::insert(), std::__debug::vector< _Tp, _Allocator >::resize(), and std::__debug::deque< _Tp, _Allocator >::resize().

void __gnu_debug::_Safe_sequence_base::_M_revalidate_singular | ( |  | ) | `[protected, inherited]`

Revalidates all attached singular iterators. This method may be used to validate iterators that were invalidated before (but for some reasion, such as an exception, need to become valid again).

Referenced by std::__debug::deque< _Tp, _Allocator >::erase(), and std::__debug::list< _Tp, _Allocator >::resize().

void __gnu_debug::_Safe_sequence_base::_M_swap | ( | _Safe_sequence_base & | __x | ) | `[protected, inherited]`

Swap this sequence with the given sequence. This operation also swaps ownership of the iterators, so that when the operation is complete all iterators that originally referenced one container now reference the other container.

Referenced by std::__debug::vector< _Tp, _Allocator >::swap(), __gnu_debug::basic_string< _CharT, _Traits, _Allocator >::swap(), std::__debug::set< _Key, _Compare, _Allocator >::swap(), std::__debug::multiset< _Key, _Compare, _Allocator >::swap(), std::__debug::multimap< _Key, _Tp, _Compare, _Allocator >::swap(), std::__debug::map< _Key, _Tp, _Compare, _Allocator >::swap(), std::__debug::list< _Tp, _Allocator >::swap(), __gnu_cxx::__debug::hash_set< _Value, _HashFcn, _EqualKey, _Alloc >::swap(), __gnu_cxx::__debug::hash_multiset< _Value, _HashFcn, _EqualKey, _Alloc >::swap(), __gnu_cxx::__debug::hash_multimap< _Value, _Tp, _HashFcn, _EqualKey, _Alloc >::swap(), __gnu_cxx::__debug::hash_map< _Value, _Tp, _HashFcn, _EqualKey, _Alloc >::swap(), and std::__debug::deque< _Tp, _Allocator >::swap().

template<typename _Sequence>
template<typename _Iterator>

void __gnu_debug::_Safe_sequence< _Sequence >::_M_transfer_iter | ( | const _Safe_iterator< _Iterator, _Sequence > & | __x | ) | `[inherited]`

Transfers all iterators that reference this memory location to this sequence from whatever sequence they are attached to.

Definition at line 159 of file safe_sequence.h.

References __gnu_debug::_Safe_sequence_base::_M_const_iterators, __gnu_debug::_Safe_sequence_base::_M_iterators, __gnu_debug::_Safe_iterator_base::_M_sequence, and __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::base().

Referenced by std::__debug::list< _Tp, _Allocator >::splice().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

void std::__debug::list< _Tp, _Allocator >::assign | ( | size_type | __n,
|  | const _Tp & | __t |
| ) |  |  | `[inline]`

Assigns a given value to a list.

Parameters:

  | n | Number of elements to be assigned.
  | val | Value to be assigned.

This function fills a list with n copies of the given value. 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 from std::list< _Tp, _Allocator >.

Definition at line 140 of file debug/list.

References std::list< _Tp, _Allocator >::assign().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>
template<class _InputIterator>

void std::__debug::list< _Tp, _Allocator >::assign | ( | _InputIterator | __first,
|  | _InputIterator | __last |
| ) |  |  | `[inline]`

Assigns a range to a list.

Parameters:

  | first | An input iterator.
  | last | An input iterator.

This function fills a list with copies of the elements in the range [first,last).

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 from std::list< _Tp, _Allocator >.

Definition at line 132 of file debug/list.

References __glibcxx_check_valid_range, and std::list< _Tp, _Allocator >::assign().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

const_reference std::__debug::list< _Tp, _Allocator >::back | ( |  | ) | const`[inline]`

Returns a read-only (constant) reference to the data at the last element of the list.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 237 of file debug/list.

References __glibcxx_check_nonempty, and std::list< _Tp, _Allocator >::back().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

reference std::__debug::list< _Tp, _Allocator >::back | ( |  | ) | `[inline]`

Returns a read/write reference to the data at the last element of the list.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 230 of file debug/list.

References __glibcxx_check_nonempty, and std::list< _Tp, _Allocator >::back().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

const_iterator std::__debug::list< _Tp, _Allocator >::begin | ( |  | ) | const`[inline]`

Returns a read-only (constant) iterator that points to the first element in the list. Iteration is done in ordinary element order.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 154 of file debug/list.

References std::list< _Tp, _Allocator >::begin().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

iterator std::__debug::list< _Tp, _Allocator >::begin | ( |  | ) | `[inline]`

Returns a read/write iterator that points to the first element in the list. Iteration is done in ordinary element order.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 150 of file debug/list.

References std::list< _Tp, _Allocator >::begin().

Referenced by std::__debug::list< _Tp, _Allocator >::merge(), std::__debug::list< _Tp, _Allocator >::pop_front(), std::__debug::list< _Tp, _Allocator >::remove(), std::__debug::list< _Tp, _Allocator >::remove_if(), std::__debug::list< _Tp, _Allocator >::rend(), std::__debug::list< _Tp, _Allocator >::resize(), std::__debug::list< _Tp, _Allocator >::splice(), and std::__debug::list< _Tp, _Allocator >::unique().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

void std::__debug::list< _Tp, _Allocator >::clear | ( |  | ) | `[inline]`

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 from std::list< _Tp, _Allocator >.

Definition at line 321 of file debug/list.

References std::list< _Tp, _Allocator >::clear().

bool std::list< _Tp , _Allocator >::empty | ( |  | ) | const`[inline, inherited]`

Returns true if the list is empty. (Thus begin() would equal end().)

Definition at line 654 of file stl_list.h.

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

const_iterator std::__debug::list< _Tp, _Allocator >::end | ( |  | ) | const`[inline]`

Returns a read-only (constant) iterator that points one past the last element in the list. Iteration is done in ordinary element order.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 162 of file debug/list.

References std::list< _Tp, _Allocator >::end().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

iterator std::__debug::list< _Tp, _Allocator >::end | ( |  | ) | `[inline]`

Returns a read/write iterator that points one past the last element in the list. Iteration is done in ordinary element order.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 158 of file debug/list.

References std::list< _Tp, _Allocator >::end().

Referenced by std::__debug::list< _Tp, _Allocator >::merge(), std::__debug::list< _Tp, _Allocator >::pop_back(), std::__debug::list< _Tp, _Allocator >::rbegin(), std::__debug::list< _Tp, _Allocator >::resize(), std::__debug::list< _Tp, _Allocator >::splice(), and std::__debug::list< _Tp, _Allocator >::unique().

iterator std::list< _Tp , _Allocator >::erase | ( | iterator | __first,
|  | iterator | __last |
| ) |  |  | `[inline, inherited]`

Remove a range of elements.

Parameters:

  | first | Iterator pointing to the first element to be erased.
  | last | Iterator pointing to one past the last element to be erased.

Returns:
  An iterator pointing to the element pointed to by last prior to erasing (or end()).

This function will erase the elements in the range [first,last) and shorten the list accordingly.

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.

iterator std::list< _Tp , _Allocator >::erase | ( | iterator | __position | ) | `[inherited]`

Remove element at given position.

Parameters:

  | position | Iterator pointing to element to be erased.

Returns:
  An iterator pointing to the next element (or end()).

This function will erase the element at the given position and thus shorten 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. 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.

Referenced by std::__debug::list< _Tp, _Allocator >::erase().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

const_reference std::__debug::list< _Tp, _Allocator >::front | ( |  | ) | const`[inline]`

Returns a read-only (constant) reference to the data at the first element of the list.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 223 of file debug/list.

References __glibcxx_check_nonempty, and std::list< _Tp, _Allocator >::front().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

reference std::__debug::list< _Tp, _Allocator >::front | ( |  | ) | `[inline]`

Returns a read/write reference to the data at the first element of the list.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 216 of file debug/list.

References __glibcxx_check_nonempty, and std::list< _Tp, _Allocator >::front().

allocator_type std::list< _Tp , _Allocator >::get_allocator | ( |  | ) | const`[inline, inherited]`

Get a copy of the memory allocation object.

Reimplemented from std::_List_base< _Tp, _Allocator >.

Definition at line 573 of file stl_list.h.

void std::list< _Tp , _Allocator >::insert | ( | iterator | __position,
|  | _InputIterator | __first,
|  | _InputIterator | __last |
| ) |  |  | `[inline, inherited]`

Inserts a range into the list.

Parameters:

  | position | An iterator into the list.
  | first | An input iterator.
  | last | An input iterator.

This function will insert copies of the data in the range [first,last) into the list before the location specified by position.

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.

void std::list< _Tp , _Allocator >::insert | ( | iterator | __position,
|  | size_type | __n,
|  | const value_type & | __x |
| ) |  |  | `[inline, inherited]`

Inserts a number of copies of given data into the list.

Parameters:

  | position | An iterator into the list.
  | n | Number of elements to be inserted.
  | x | Data to be inserted.

This function will insert a specified number of copies of the given data before the location specified by position.

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.

iterator std::list< _Tp , _Allocator >::insert | ( | iterator | __position,
|  | const value_type & | __x |
| ) |  |  | `[inherited]`

Inserts given value into list before specified iterator.

Parameters:

  | position | An iterator into the list.
  | x | Data to be inserted.

Returns:
  An iterator that points to the inserted data.

This function will insert a copy of the given value before the specified location. Due to the nature of a list this operation can be done in constant time, and does not invalidate iterators and references.

Referenced by std::__debug::list< _Tp, _Allocator >::insert().

size_type std::list< _Tp , _Allocator >::max_size | ( |  | ) | const`[inline, inherited]`

Returns the size() of the largest possible list.

Definition at line 664 of file stl_list.h.

void std::list< _Tp , _Allocator >::merge | ( | list< _Tp, _Allocator > & | ,
|  | _StrictWeakOrdering |  |
| ) |  |  | `[inherited]`

Merge sorted lists according to comparison function.

Parameters:

  | x | Sorted list to merge.
  | StrictWeakOrdering | Comparison function definining sort order.

Assumes that both x and this list are sorted according to StrictWeakOrdering. Merges elements of x into this list in sorted order, leaving x empty when complete. Elements in this list precede elements in x that are equivalent according to StrictWeakOrdering().

void std::list< _Tp , _Allocator >::merge | ( | list< _Tp, _Allocator > & | __x | ) | `[inherited]`

Merge sorted lists.

Parameters:

  | x | Sorted list to merge.

Assumes that both x and this list are sorted according to operator<(). Merges elements of x into this list in sorted order, leaving x empty when complete. Elements in this list precede elements in x that are equal.

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

void std::__debug::list< _Tp, _Allocator >::pop_back | ( |  | ) | `[inline]`

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 from std::list< _Tp, _Allocator >.

Definition at line 258 of file debug/list.

References __glibcxx_check_nonempty, __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_invalidate(), std::__debug::list< _Tp, _Allocator >::end(), and std::list< _Tp, _Allocator >::pop_back().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

void std::__debug::list< _Tp, _Allocator >::pop_front | ( |  | ) | `[inline]`

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 from std::list< _Tp, _Allocator >.

Definition at line 247 of file debug/list.

References __glibcxx_check_nonempty, __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_invalidate(), std::__debug::list< _Tp, _Allocator >::begin(), and std::list< _Tp, _Allocator >::pop_front().

void std::list< _Tp , _Allocator >::push_back | ( | const value_type & | __x | ) | `[inline, inherited]`

Add data to the end of the list.

Parameters:

  | x | Data to be added.

This is a typical stack operation. The function creates an element at the end of the list and assigns the given data to it. 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 763 of file stl_list.h.

void std::list< _Tp , _Allocator >::push_front | ( | const value_type & | __x | ) | `[inline, inherited]`

Add data to the front of the list.

Parameters:

  | x | Data to be added.

This is a typical stack operation. The function creates an element at the front of the list and assigns the given data to it. 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 733 of file stl_list.h.

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

const_reverse_iterator std::__debug::list< _Tp, _Allocator >::rbegin | ( |  | ) | const`[inline]`

Returns a read-only (constant) reverse iterator that points to the last element in the list. Iteration is done in reverse element order.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 170 of file debug/list.

References std::__debug::list< _Tp, _Allocator >::end().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

reverse_iterator std::__debug::list< _Tp, _Allocator >::rbegin | ( |  | ) | `[inline]`

Returns a read/write reverse iterator that points to the last element in the list. Iteration is done in reverse element order.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 166 of file debug/list.

References std::__debug::list< _Tp, _Allocator >::end().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

void std::__debug::list< _Tp, _Allocator >::remove | ( | const _Tp & | __value | ) | `[inline]`

Remove all elements equal to value.

Parameters:

  | value | The value to remove.

Removes every element in the list equal to value. 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 from std::list< _Tp, _Allocator >.

Definition at line 389 of file debug/list.

References __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::base(), std::__debug::list< _Tp, _Allocator >::begin(), std::list< _Tp, _Allocator >::end(), and std::__debug::list< _Tp, _Allocator >::erase().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>
template<class _Predicate>

void std::__debug::list< _Tp, _Allocator >::remove_if | ( | _Predicate | __pred | ) | `[inline]`

Remove all elements satisfying a predicate.

Parameters:

  | Predicate | Unary predicate function or object.

Removes every element in the list for which the predicate returns true. 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 from std::list< _Tp, _Allocator >.

Definition at line 402 of file debug/list.

References __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::base(), std::__debug::list< _Tp, _Allocator >::begin(), std::list< _Tp, _Allocator >::end(), and std::__debug::list< _Tp, _Allocator >::erase().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

const_reverse_iterator std::__debug::list< _Tp, _Allocator >::rend | ( |  | ) | const`[inline]`

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 from std::list< _Tp, _Allocator >.

Definition at line 178 of file debug/list.

References std::__debug::list< _Tp, _Allocator >::begin().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

reverse_iterator std::__debug::list< _Tp, _Allocator >::rend | ( |  | ) | `[inline]`

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 from std::list< _Tp, _Allocator >.

Definition at line 174 of file debug/list.

References std::__debug::list< _Tp, _Allocator >::begin().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

void std::__debug::list< _Tp, _Allocator >::resize | ( | size_type | __sz,
|  | _Tp | __c = `_Tp()` |
| ) |  |  | `[inline]`

Resizes the list to the specified number of elements.

Parameters:

  | new_size | Number of elements the list should contain.
  | x | Data with which new elements should be populated.

This function will resize the list to the specified number of elements. If the number is smaller than the list's current size the list is truncated, otherwise the list is extended and new elements are populated with given data.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 187 of file debug/list.

References __gnu_debug::_Safe_sequence_base::_M_detach_singular(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_invalidate(), __gnu_debug::_Safe_sequence_base::_M_revalidate_singular(), std::__debug::list< _Tp, _Allocator >::begin(), std::__debug::list< _Tp, _Allocator >::end(), and std::list< _Tp, _Allocator >::resize().

void std::list< _Tp , _Allocator >::reverse | ( |  | ) | `[inline, inherited]`

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.

size_type std::list< _Tp , _Allocator >::size | ( |  | ) | const`[inline, inherited]`

Returns the number of elements in the list.

Definition at line 659 of file stl_list.h.

References std::distance().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>
template<typename _StrictWeakOrdering>

void std::__debug::list< _Tp, _Allocator >::sort | ( | _StrictWeakOrdering | __pred | ) | `[inline]`

Sort the elements according to comparison function.

Sorts the elements of this list in NlogN time. Equivalent elements remain in list order.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 483 of file debug/list.

References std::sort().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

void std::__debug::list< _Tp, _Allocator >::sort | ( |  | ) | `[inline]`

Sort the elements.

Sorts the elements of this list in NlogN time. Equivalent elements remain in list order.

Reimplemented from std::list< _Tp, _Allocator >.

Definition at line 479 of file debug/list.

References std::sort().

void std::list< _Tp , _Allocator >::splice | ( | iterator | __position,
|  | list< _Tp, _Allocator > & | __x,
|  | iterator | __first,
|  | iterator | __last |
| ) |  |  | `[inline, inherited]`

Insert range from another list.

Parameters:

  | position | Iterator referencing the element to insert before.
  | x | Source list.
  | first | Iterator referencing the start of range in x.
  | last | Iterator referencing the end of range in x.

Removes elements in the range [first,last) and inserts them before position in constant time.

Undefined if position is in [first,last).

Definition at line 972 of file stl_list.h.

void std::list< _Tp , _Allocator >::splice | ( | iterator | __position,
|  | list< _Tp, _Allocator > & | __x,
|  | iterator | __i |
| ) |  |  | `[inline, inherited]`

Insert element from another list.

Parameters:

  | position | Iterator referencing the element to insert before.
  | x | Source list.
  | i | Iterator referencing the element to move.

Removes the element in list x referenced by i and inserts it into the current list before position.

Definition at line 946 of file stl_list.h.

void std::list< _Tp , _Allocator >::splice | ( | iterator | __position,
|  | list< _Tp, _Allocator > & | __x |
| ) |  |  | `[inline, inherited]`

Insert contents of another list.

Parameters:

  | position | Iterator referencing the element to insert before.
  | x | Source list.

The elements of x are inserted in constant time in front of the element referenced by position. x becomes an empty list.

Requires this != x.

Definition at line 926 of file stl_list.h.

References std::list< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::empty(), and std::list< _Tp, _Alloc >::end().

Referenced by std::__debug::list< _Tp, _Allocator >::splice().

void std::list< _Tp , _Allocator >::swap | ( | list< _Tp, _Allocator > & | __x | ) | `[inline, inherited]`

Swaps data with another list.

Parameters:

  | x | A list of the same element and allocator types.

This exchanges the elements between two lists in constant time. Note that the global std::swap() function is specialized such that std::swap(l1,l2) will feed to this function.

Definition at line 890 of file stl_list.h.

References std::_List_base< _Tp, _Alloc >::_M_get_Node_allocator(), std::_List_base< _Tp, _Alloc >::_M_impl, std::__alloc_swap< _Alloc, >::_S_do_it(), and std::tr1::swap().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>
template<class _BinaryPredicate>

void std::__debug::list< _Tp, _Allocator >::unique | ( | _BinaryPredicate | __binary_pred | ) | `[inline]`

Remove consecutive elements satisfying a predicate.

Parameters:

  | BinaryPredicate | Binary predicate function or object.

For each consecutive set of elements [first,last) that satisfy predicate(first,i) where i is an iterator in [first,last), 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 from std::list< _Tp, _Allocator >.

Definition at line 433 of file debug/list.

References std::__debug::list< _Tp, _Allocator >::begin(), std::__debug::list< _Tp, _Allocator >::end(), and std::__debug::list< _Tp, _Allocator >::erase().

template<typename _Tp, typename _Allocator = std::allocator<_Tp>>

void std::__debug::list< _Tp, _Allocator >::unique | ( |  | ) | `[inline]`

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 from std::list< _Tp, _Allocator >.

Definition at line 414 of file debug/list.

References std::__debug::list< _Tp, _Allocator >::begin(), std::__debug::list< _Tp, _Allocator >::end(), and std::__debug::list< _Tp, _Allocator >::erase().

## Member Data Documentation

_Safe_iterator_base* __gnu_debug::_Safe_sequence_base::_M_const_iterators `[inherited]`

The list of constant iterators that reference this container.

Definition at line 171 of file safe_base.h.

Referenced by __gnu_debug::_Safe_sequence< _Sequence >::_M_invalidate_if(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_invalidate_single(), and __gnu_debug::_Safe_sequence< _Sequence >::_M_transfer_iter().

_Safe_iterator_base* __gnu_debug::_Safe_sequence_base::_M_iterators `[inherited]`

The list of mutable iterators that reference this container.

Definition at line 168 of file safe_base.h.

Referenced by __gnu_debug::_Safe_sequence< _Sequence >::_M_invalidate_if(), __gnu_debug::_Safe_iterator< _Iterator, _Sequence >::_M_invalidate_single(), and __gnu_debug::_Safe_sequence< _Sequence >::_M_transfer_iter().

unsigned int __gnu_debug::_Safe_sequence_base::_M_version `[mutable, inherited]`

The container version number. This number may never be 0.

Definition at line 174 of file safe_base.h.

Referenced by __gnu_debug::_Safe_sequence_base::_M_invalidate_all().

The documentation for this class was generated from the following file:

- debug/list