SYNOPSIS

Inherits std::_List_base< _Tp, _Alloc >.

Public Types

typedef _Alloc allocator_type

typedef _List_const_iterator< _Tp > const_iterator

typedef

_Tp_alloc_type::const_pointer const_pointer"

typedef

_Tp_alloc_type::const_reference const_reference"

typedef std::reverse_iterator

< const_iterator > const_reverse_iterator"

typedef ptrdiff_t difference_type

typedef _List_iterator< _Tp > iterator

typedef _Tp_alloc_type::pointer pointer

typedef _Tp_alloc_type::reference reference

typedef std::reverse_iterator

< iterator > reverse_iterator"

typedef size_t size_type

typedef _Tp value_type

Public Member Functions

list () noexcept(is_nothrow_default_constructible< _Node_alloc_type >::value)

list (const allocator_type &__a) noexcept

list (size_type __n)

list (size_type __n, const value_type &__value, const allocator_type &__a=allocator_type())

list (const list &__x)

list (list &&__x) noexcept

list (initializer_list< value_type > __l, const allocator_type &__a=allocator_type())

template<typename _InputIterator , typename = std::_RequireInputIter<_InputIterator>> list (_InputIterator __first, _InputIterator __last, const allocator_type &__a=allocator_type())

void assign (size_type __n, const value_type &__val)

template<typename _InputIterator , typename = std::_RequireInputIter<_InputIterator>> void assign (_InputIterator __first, _InputIterator __last)

void assign (initializer_list< value_type > __l)

reference back () noexcept

const_reference back () const noexcept

iterator begin () noexcept

const_iterator begin () const noexcept

const_iterator cbegin () const noexcept

const_iterator cend () const noexcept

void clear () noexcept

const_reverse_iterator crbegin () const noexcept

const_reverse_iterator crend () const noexcept

template<typename... _Args> iterator emplace (const_iterator __position, _Args &&...__args)

template<typename... _Args> void emplace_back (_Args &&...__args)

template<typename... _Args> void emplace_front (_Args &&...__args)

bool empty () const noexcept

iterator end () noexcept

const_iterator end () const noexcept

iterator erase (const_iterator __position) noexcept

iterator erase (const_iterator __first, const_iterator __last) noexcept

reference front () noexcept

const_reference front () const noexcept

allocator_type get_allocator () const noexcept

iterator insert (const_iterator __position, const value_type &__x)

iterator insert (const_iterator __position, value_type &&__x)

iterator insert (const_iterator __p, initializer_list< value_type > __l)

iterator insert (const_iterator __position, size_type __n, const value_type &__x)

template<typename _InputIterator , typename = std::_RequireInputIter<_InputIterator>> iterator insert (const_iterator __position, _InputIterator __first, _InputIterator __last)

size_type max_size () const noexcept

void merge (list &&__x)

void merge (list &__x)

template<typename _StrictWeakOrdering > void merge (list &&__x, _StrictWeakOrdering __comp)

template<typename _StrictWeakOrdering > void merge (list &__x, _StrictWeakOrdering __comp)

list & operator= (const list &__x)

list & operator= (list &&__x)

list & operator= (initializer_list< value_type > __l)

void pop_back () noexcept

void pop_front () noexcept

void push_back (const value_type &__x)

void push_back (value_type &&__x)

void push_front (const value_type &__x)

void push_front (value_type &&__x)

reverse_iterator rbegin () noexcept

const_reverse_iterator rbegin () const noexcept

void remove (const _Tp &__value)

template<typename _Predicate > void remove_if (_Predicate)

reverse_iterator rend () noexcept

const_reverse_iterator rend () const noexcept

void resize (size_type __new_size)

void resize (size_type __new_size, const value_type &__x)

void reverse () noexcept

size_type size () const noexcept

void sort ()

template<typename _StrictWeakOrdering > void sort (_StrictWeakOrdering)

void splice (const_iterator __position, list &&__x) noexcept

void splice (const_iterator __position, list &__x) noexcept

void splice (const_iterator __position, list &&__x, const_iterator __i) noexcept

void splice (const_iterator __position, list &__x, const_iterator __i) noexcept

void splice (const_iterator __position, list &&__x, const_iterator __first, const_iterator __last) noexcept

void splice (const_iterator __position, list &__x, const_iterator __first, const_iterator __last) noexcept

void swap (list &__x)

void unique ()

template<typename _BinaryPredicate > void unique (_BinaryPredicate)

Protected Types

typedef _List_node< _Tp > _Node

Protected Member Functions

template<typename _Integer > void _M_assign_dispatch (_Integer __n, _Integer __val, __true_type)

template<typename _InputIterator > void _M_assign_dispatch (_InputIterator __first, _InputIterator __last, __false_type)

void _M_check_equal_allocators (list &__x) noexcept

void _M_clear () noexcept

template<typename... _Args> _Node * _M_create_node (_Args &&...__args)

void _M_default_append (size_type __n)

void _M_default_initialize (size_type __n)

void _M_erase (iterator __position) noexcept

void _M_fill_assign (size_type __n, const value_type &__val)

void _M_fill_initialize (size_type __n, const value_type &__x)

_List_node< _Tp > * _M_get_node ()

_Node_alloc_type & _M_get_Node_allocator () noexcept

const _Node_alloc_type & _M_get_Node_allocator () const noexcept

_Tp_alloc_type _M_get_Tp_allocator () const noexcept

void _M_init () noexcept

template<typename _Integer > void _M_initialize_dispatch (_Integer __n, _Integer __x, __true_type)

template<typename _InputIterator > void _M_initialize_dispatch (_InputIterator __first, _InputIterator __last, __false_type)

template<typename... _Args> void _M_insert (iterator __position, _Args &&...__args)

void _M_put_node (_List_node< _Tp > *__p) noexcept

void _M_transfer (iterator __position, iterator __first, iterator __last)

Protected Attributes

_List_impl _M_impl

Detailed Description

template<typename _Tp, typename _Alloc = std::allocator<_Tp>>class std::list< _Tp, _Alloc >

A standard container with linear time access to elements, and fixed time insertion/deletion at any point in the sequence.

Template Parameters:

_Tp Type of element.

_Alloc Allocator type, defaults to allocator<_Tp>.

Meets the requirements of a container, a reversible container, and a sequence, including the optional sequence requirements with the exception of 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.

A couple points on memory allocation for list<Tp>:

First, we never actually allocate a Tp, we allocate List_node<Tp>'s and trust [20.1.5]/4 to DTRT. This is to ensure that after elements from list<X,Alloc1> are spliced into list<X,Alloc2>, destroying the memory of the second list is a valid operation, i.e., Alloc1 giveth and Alloc2 taketh away.

Second, a list conceptually represented as

A <---> B <---> C <---> D

is actually circular; a link exists between A and D. The list class holds (as its only data member) a private list::iterator pointing to D, not to A! To get to the head of the list, we start at the tail and move forward by one. When this member iterator's next/previous pointers refer to itself, the list is empty.

Definition at line 447 of file stl_list.h.

Constructor & Destructor Documentation

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBstd::list\fP< _Tp, _Alloc >::\fBlist\fP ()\fC [inline]\fP, \fC [noexcept]\fP

Creates a list with no elements.

Definition at line 533 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBstd::list\fP< _Tp, _Alloc >::\fBlist\fP (const allocator_type &__a)\fC [inline]\fP, \fC [explicit]\fP, \fC [noexcept]\fP

Creates a list with no elements.

Parameters:

__a An allocator object.

Definition at line 544 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBstd::list\fP< _Tp, _Alloc >::\fBlist\fP (size_type__n)\fC [inline]\fP, \fC [explicit]\fP

Creates a list with default constructed elements.

Parameters:

__n The number of elements to initially create.

This constructor fills the list with __n default constructed elements.

Definition at line 556 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBstd::list\fP< _Tp, _Alloc >::\fBlist\fP (size_type__n, const value_type &__value, const allocator_type &__a = \fCallocator_type()\fP)\fC [inline]\fP

Creates a list with copies of an exemplar element.

Parameters:

__n The number of elements to initially create.

__value An element to copy.

__a An allocator object.

This constructor fills the list with __n copies of __value.

Definition at line 568 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBstd::list\fP< _Tp, _Alloc >::\fBlist\fP (const \fBlist\fP< _Tp, _Alloc > &__x)\fC [inline]\fP

List copy constructor.

Parameters:

__x A list of identical element and allocator types.

The newly-created list uses a copy of the allocation object used by __x.

Definition at line 595 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBstd::list\fP< _Tp, _Alloc >::\fBlist\fP (\fBlist\fP< _Tp, _Alloc > &&__x)\fC [inline]\fP, \fC [noexcept]\fP

List move constructor.

Parameters:

__x A list of identical element and allocator types.

The newly-created list contains the exact contents of __x. The contents of __x are a valid, but unspecified list.

Definition at line 607 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBstd::list\fP< _Tp, _Alloc >::\fBlist\fP (initializer_list< value_type >__l, const allocator_type &__a = \fCallocator_type()\fP)\fC [inline]\fP

Builds a list from an initializer_list.

Parameters:

__l An initializer_list of value_type.

__a An allocator object.

Create a list consisting of copies of the elements in the initializer_list __l. This is linear in __l.size().

Definition at line 618 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> template<typename _InputIterator , typename = std::_RequireInputIter<_InputIterator>> \fBstd::list\fP< _Tp, _Alloc >::\fBlist\fP (_InputIterator__first, _InputIterator__last, const allocator_type &__a = \fCallocator_type()\fP)\fC [inline]\fP

Builds a list from a range.

Parameters:

__first An input iterator.

__last An input iterator.

__a An allocator object.

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

Definition at line 637 of file stl_list.h.

Member Function Documentation

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> template<typename... _Args> \fB_Node\fP* \fBstd::list\fP< _Tp, _Alloc >::_M_create_node (_Args &&...__args)\fC [inline]\fP, \fC [protected]\fP

Parameters:

__args An instance of user data.

Allocates space for a new node and constructs a copy of __args in it.

Definition at line 509 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::assign (size_type__n, const value_type &__val)\fC [inline]\fP

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.

Definition at line 715 of file stl_list.h.

Referenced by std::list< __inp, __rebind_inp >::assign(), and std::list< __inp, __rebind_inp >::operator=().

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> template<typename _InputIterator , typename = std::_RequireInputIter<_InputIterator>> void \fBstd::list\fP< _Tp, _Alloc >::assign (_InputIterator__first, _InputIterator__last)\fC [inline]\fP

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.

Definition at line 734 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::assign (initializer_list< value_type >__l)\fC [inline]\fP

Assigns an initializer_list to a list.

Parameters:

__l An initializer_list of value_type.

Replace the contents of the list with copies of the elements in the initializer_list __l. This is linear in __l.size().

Definition at line 756 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> reference \fBstd::list\fP< _Tp, _Alloc >::back ()\fC [inline]\fP, \fC [noexcept]\fP

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

Definition at line 956 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> const_reference \fBstd::list\fP< _Tp, _Alloc >::back () const\fC [inline]\fP, \fC [noexcept]\fP

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

Definition at line 968 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBiterator\fP \fBstd::list\fP< _Tp, _Alloc >::begin ()\fC [inline]\fP, \fC [noexcept]\fP

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

Definition at line 771 of file stl_list.h.

Referenced by std::list< __inp, __rebind_inp >::crend(), std::list< __inp, __rebind_inp >::front(), std::list< __inp, __rebind_inp >::list(), std::operator==(), std::list< __inp, __rebind_inp >::pop_front(), std::list< __inp, __rebind_inp >::push_front(), std::list< __inp, __rebind_inp >::rend(), std::list< __inp, __rebind_inp >::size(), and std::list< __inp, __rebind_inp >::splice().

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBconst_iterator\fP \fBstd::list\fP< _Tp, _Alloc >::begin () const\fC [inline]\fP, \fC [noexcept]\fP

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 780 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBconst_iterator\fP \fBstd::list\fP< _Tp, _Alloc >::cbegin () const\fC [inline]\fP, \fC [noexcept]\fP

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 844 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBconst_iterator\fP \fBstd::list\fP< _Tp, _Alloc >::cend () const\fC [inline]\fP, \fC [noexcept]\fP

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 853 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::clear ()\fC [inline]\fP, \fC [noexcept]\fP

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 responsibility.

Definition at line 1302 of file stl_list.h.

Referenced by std::list< __inp, __rebind_inp >::operator=().

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBconst_reverse_iterator\fP \fBstd::list\fP< _Tp, _Alloc >::crbegin () const\fC [inline]\fP, \fC [noexcept]\fP

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 862 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBconst_reverse_iterator\fP \fBstd::list\fP< _Tp, _Alloc >::crend () const\fC [inline]\fP, \fC [noexcept]\fP

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 871 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> template<typename... _Args> \fBiterator\fP \fBstd::list\fP< _Tp, _Alloc >::emplace (\fBconst_iterator\fP__position, _Args &&...__args)

Constructs object in list before specified iterator.

Parameters:

__position A const_iterator into the list.

__args Arguments.

Returns:

An iterator that points to the inserted data.

This function will insert an object of type T constructed with T(std::forward<Args>(args)...) 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::list< __inp, __rebind_inp >::insert().

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> bool \fBstd::list\fP< _Tp, _Alloc >::empty () const\fC [inline]\fP, \fC [noexcept]\fP

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

Definition at line 881 of file stl_list.h.

Referenced by std::list< __inp, __rebind_inp >::splice().

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBiterator\fP \fBstd::list\fP< _Tp, _Alloc >::end ()\fC [inline]\fP, \fC [noexcept]\fP

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 789 of file stl_list.h.

Referenced by std::list< __inp, __rebind_inp >::back(), std::list< __inp, __rebind_inp >::crbegin(), std::list< __inp, __rebind_inp >::list(), std::operator==(), std::list< __inp, __rebind_inp >::push_back(), std::list< __inp, __rebind_inp >::rbegin(), std::list< __inp, __rebind_inp >::size(), and std::list< __inp, __rebind_inp >::splice().

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBconst_iterator\fP \fBstd::list\fP< _Tp, _Alloc >::end () const\fC [inline]\fP, \fC [noexcept]\fP

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 798 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBiterator\fP \fBstd::list\fP< _Tp, _Alloc >::erase (\fBconst_iterator\fP__position)\fC [noexcept]\fP

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 responsibility.

Referenced by std::list< __inp, __rebind_inp >::erase().

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBiterator\fP \fBstd::list\fP< _Tp, _Alloc >::erase (\fBconst_iterator\fP__first, \fBconst_iterator\fP__last)\fC [inline]\fP, \fC [noexcept]\fP

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 responsibility.

Definition at line 1264 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> reference \fBstd::list\fP< _Tp, _Alloc >::front ()\fC [inline]\fP, \fC [noexcept]\fP

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

Definition at line 940 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> const_reference \fBstd::list\fP< _Tp, _Alloc >::front () const\fC [inline]\fP, \fC [noexcept]\fP

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

Definition at line 948 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> allocator_type \fBstd::list\fP< _Tp, _Alloc >::get_allocator () const\fC [inline]\fP, \fC [noexcept]\fP

Get a copy of the memory allocation object.

Definition at line 762 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBiterator\fP \fBstd::list\fP< _Tp, _Alloc >::insert (\fBconst_iterator\fP__position, const value_type &__x)

Inserts given value into list before specified iterator.

Parameters:

__position A const_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::list< __inp, __rebind_inp >::insert().

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBiterator\fP \fBstd::list\fP< _Tp, _Alloc >::insert (\fBconst_iterator\fP__position, value_type &&__x)\fC [inline]\fP

Inserts given rvalue into list before specified iterator.

Parameters:

__position A const_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 rvalue 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.

Definition at line 1116 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBiterator\fP \fBstd::list\fP< _Tp, _Alloc >::insert (\fBconst_iterator\fP__p, initializer_list< value_type >__l)\fC [inline]\fP

Inserts the contents of an initializer_list into list before specified const_iterator.

Parameters:

__p A const_iterator into the list.

__l An initializer_list of value_type.

Returns:

An iterator pointing to the first element inserted (or __position).

This function will insert copies of the data in the initializer_list l into the list before the location specified by p.

This operation is linear in the number of elements inserted and does not invalidate iterators and references.

Definition at line 1135 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBiterator\fP \fBstd::list\fP< _Tp, _Alloc >::insert (\fBconst_iterator\fP__position, size_type__n, const value_type &__x)

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

Parameters:

__position A const_iterator into the list.

__n Number of elements to be inserted.

__x Data to be inserted.

Returns:

An iterator pointing to the first element inserted (or __position).

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.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> template<typename _InputIterator , typename = std::_RequireInputIter<_InputIterator>> \fBiterator\fP \fBstd::list\fP< _Tp, _Alloc >::insert (\fBconst_iterator\fP__position, _InputIterator__first, _InputIterator__last)

Inserts a range into the list.

Parameters:

__position A const_iterator into the list.

__first An input iterator.

__last An input iterator.

Returns:

An iterator pointing to the first element inserted (or __position).

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.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> size_type \fBstd::list\fP< _Tp, _Alloc >::max_size () const\fC [inline]\fP, \fC [noexcept]\fP

Returns the size() of the largest possible list.

Definition at line 891 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::merge (\fBlist\fP< _Tp, _Alloc > &&__x)

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 _Alloc = std::allocator<_Tp>> template<typename _StrictWeakOrdering > void \fBstd::list\fP< _Tp, _Alloc >::merge (\fBlist\fP< _Tp, _Alloc > &&__x, _StrictWeakOrdering__comp)

Merge sorted lists according to comparison function.

Template Parameters:

_StrictWeakOrdering Comparison function defining sort order.

Parameters:

__x Sorted list to merge.

__comp Comparison functor.

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().

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBlist\fP& \fBstd::list\fP< _Tp, _Alloc >::operator= (const \fBlist\fP< _Tp, _Alloc > &__x)

List assignment operator. No explicit dtor needed as the _Base dtor takes care of things. The _Base dtor only erases the elements, and note that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Parameters:

__x A list of identical element and allocator types.

All the elements of __x are copied, but unlike the copy constructor, the allocator object is not copied.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBlist\fP& \fBstd::list\fP< _Tp, _Alloc >::operator= (\fBlist\fP< _Tp, _Alloc > &&__x)\fC [inline]\fP

List move assignment operator.

Parameters:

__x A list of identical element and allocator types.

The contents of __x are moved into this list (without copying). __x is a valid, but unspecified list

Definition at line 680 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBlist\fP& \fBstd::list\fP< _Tp, _Alloc >::operator= (initializer_list< value_type >__l)\fC [inline]\fP

List initializer list assignment operator.

Parameters:

__l An initializer_list of value_type.

Replace the contents of the list with copies of the elements in the initializer_list __l. This is linear in l.size().

Definition at line 697 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::pop_back ()\fC [inline]\fP, \fC [noexcept]\fP

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 1054 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::pop_front ()\fC [inline]\fP, \fC [noexcept]\fP

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 1014 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::push_back (const value_type &__x)\fC [inline]\fP

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 1028 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::push_front (const value_type &__x)\fC [inline]\fP

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 987 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBreverse_iterator\fP \fBstd::list\fP< _Tp, _Alloc >::rbegin ()\fC [inline]\fP, \fC [noexcept]\fP

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 807 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBconst_reverse_iterator\fP \fBstd::list\fP< _Tp, _Alloc >::rbegin () const\fC [inline]\fP, \fC [noexcept]\fP

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 816 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::remove (const _Tp &__value)

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 responsibility.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> template<typename _Predicate > void \fBstd::list\fP< _Tp, _Alloc >::remove_if (_Predicate)

Remove all elements satisfying a predicate.

Template 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 responsibility.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBreverse_iterator\fP \fBstd::list\fP< _Tp, _Alloc >::rend ()\fC [inline]\fP, \fC [noexcept]\fP

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 825 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> \fBconst_reverse_iterator\fP \fBstd::list\fP< _Tp, _Alloc >::rend () const\fC [inline]\fP, \fC [noexcept]\fP

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 834 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::resize (size_type__new_size)

Resizes the list to the specified number of elements.

Parameters:

__new_size Number of elements the list should contain.

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 default constructed elements are appended.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::resize (size_type__new_size, const value_type &__x)

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.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::reverse ()\fC [inline]\fP, \fC [noexcept]\fP

Reverse the elements in list. Reverse the order of elements in the list in linear time.

Definition at line 1576 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> size_type \fBstd::list\fP< _Tp, _Alloc >::size () const\fC [inline]\fP, \fC [noexcept]\fP

Returns the number of elements in the list.

Definition at line 886 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::sort ()

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

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> template<typename _StrictWeakOrdering > void \fBstd::list\fP< _Tp, _Alloc >::sort (_StrictWeakOrdering)

Sort the elements according to comparison function. Sorts the elements of this list in NlogN time. Equivalent elements remain in list order.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::splice (\fBconst_iterator\fP__position, \fBlist\fP< _Tp, _Alloc > &&__x)\fC [inline]\fP, \fC [noexcept]\fP

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 1322 of file stl_list.h.

Referenced by std::list< __inp, __rebind_inp >::splice().

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::splice (\fBconst_iterator\fP__position, \fBlist\fP< _Tp, _Alloc > &&__x, \fBconst_iterator\fP__i)\fC [inline]\fP, \fC [noexcept]\fP

Insert element from another list.

Parameters:

__position Const_iterator referencing the element to insert before.

__x Source list.

__i Const_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 1354 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::splice (\fBconst_iterator\fP__position, \fBlist\fP< _Tp, _Alloc > &__x, \fBconst_iterator\fP__i)\fC [inline]\fP, \fC [noexcept]\fP

Insert element from another list.

Parameters:

__position Const_iterator referencing the element to insert before.

__x Source list.

__i Const_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 1393 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::splice (\fBconst_iterator\fP__position, \fBlist\fP< _Tp, _Alloc > &&__x, \fBconst_iterator\fP__first, \fBconst_iterator\fP__last)\fC [inline]\fP, \fC [noexcept]\fP

Insert range from another list.

Parameters:

__position Const_iterator referencing the element to insert before.

__x Source list.

__first Const_iterator referencing the start of range in x.

__last Const_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 1412 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::splice (\fBconst_iterator\fP__position, \fBlist\fP< _Tp, _Alloc > &__x, \fBconst_iterator\fP__first, \fBconst_iterator\fP__last)\fC [inline]\fP, \fC [noexcept]\fP

Insert range from another list.

Parameters:

__position Const_iterator referencing the element to insert before.

__x Source list.

__first Const_iterator referencing the start of range in x.

__last Const_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 1458 of file stl_list.h.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::swap (\fBlist\fP< _Tp, _Alloc > &__x)\fC [inline]\fP

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 1284 of file stl_list.h.

Referenced by std::list< __inp, __rebind_inp >::operator=(), and std::swap().

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> void \fBstd::list\fP< _Tp, _Alloc >::unique ()

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 responsibility.

template<typename _Tp, typename _Alloc = std::allocator<_Tp>> template<typename _BinaryPredicate > void \fBstd::list\fP< _Tp, _Alloc >::unique (_BinaryPredicate)

Remove consecutive elements satisfying a predicate.

Template 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 responsibility.

Author

Generated automatically by Doxygen for libstdc++ from the source code.