# std::list< _Tp, _Alloc > Class Template Reference
[Containers, Sequences]

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

`#include <stl_list.h>`

List of all members.

## Public Methods

| list (const allocator_type &__a=allocator_type())
| Default constructor creates no elements.
| list (size_type __n, const value_type &__value, const allocator_type &__a=allocator_type())
| Create a %list with copies of an exemplar element.
| list (size_type __n)
| Create a %list with default elements.
| list (const list &__x)
| %List copy constructor.
template<typename _InputIterator> | list (_InputIterator __first, _InputIterator __last, const allocator_type &__a=allocator_type())
| Builds a %list from a range.
| ~list ()
list & | operator= (const list &__x)
| %List assignment operator.
void | assign (size_type __n, const value_type &__val)
| Assigns a given value to a %list.
template<typename _InputIterator> void | assign (_InputIterator __first, _InputIterator __last)
| Assigns a range to a %list.
allocator_type | get_allocator () const
| Get a copy of the memory allocation object.
iterator | begin ()
const_iterator | begin () const
iterator | end ()
const_iterator | end () const
reverse_iterator | rbegin ()
const_reverse_iterator | rbegin () const
reverse_iterator | rend ()
const_reverse_iterator | rend () const
bool | empty () const
size_type | size () const
size_type | max_size () const
void | resize (size_type __new_size, const value_type &__x)
| Resizes the %list to the specified number of elements.
void | resize (size_type __new_size)
| Resizes the %list to the specified number of elements.
reference | front ()
const_reference | front () const
reference | back ()
const_reference | back () const
void | push_front (const value_type &__x)
| Add data to the front of the %list.
void | push_front ()
| Add data to the front of the %list.
void | pop_front ()
| Removes first element.
void | push_back (const value_type &__x)
| Add data to the end of the %list.
void | push_back ()
| Add data to the end of the %list.
void | pop_back ()
| Removes last element.
iterator | insert (iterator __position, const value_type &__x)
| Inserts given value into %list before specified iterator.
iterator | insert (iterator __position)
| Inserts an element into the %list.
void | insert (iterator __pos, size_type __n, const value_type &__x)
| Inserts a number of copies of given data into the %list.
template<typename _InputIterator> void | insert (iterator __pos, _InputIterator __first, _InputIterator __last)
| Inserts a range into the %list.
iterator | erase (iterator __position)
| Remove element at given position.
iterator | erase (iterator __first, iterator __last)
| Remove a range of elements.
void | swap (list &__x)
| Swaps data with another %list.
void | clear ()
void | splice (iterator __position, list &__x)
void | splice (iterator __position, list &, iterator __i)
void | splice (iterator __position, list &, iterator __first, iterator __last)
void | remove (const _Tp &__value)
template<typename _Predicate> void | remove_if (_Predicate)
void | unique ()
template<typename _BinaryPredicate> void | unique (_BinaryPredicate)
void | merge (list &__x)
template<typename _StrictWeakOrdering> void | merge (list &, _StrictWeakOrdering)
void | reverse ()
void | sort ()
template<typename _StrictWeakOrdering> void | sort (_StrictWeakOrdering)

## Detailed Description

### template<typename _Tp, typename _Alloc = 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.

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.

Definition at line 366 of file stl_list.h.

## Constructor & Destructor Documentation

template<typename _Tp, typename _Alloc = allocator<_Tp>>
std::list< _Tp, _Alloc >::list | ( | const allocator_type & | __a = allocator_type() | ) | `[inline, explicit]`

| Default constructor creates no elements. Definition at line 451 of file stl_list.h.

template<typename _Tp, typename _Alloc = allocator<_Tp>>
std::list< _Tp, _Alloc >::list | ( | size_type | __n,
|  | const value_type & | __value,
|  | const allocator_type & | __a = allocator_type()
| ) | `[inline]`

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.

Definition at line 461 of file stl_list.h.

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

template<typename _Tp, typename _Alloc = allocator<_Tp>>
std::list< _Tp, _Alloc >::list | ( | size_type | __n | ) | `[inline, explicit]`

Create a %list with default elements.

Parameters:

  n | The number of elements to initially create.

This constructor fills the %list with n copies of a default-constructed element.

Definition at line 474 of file stl_list.h.

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

template<typename _Tp, typename _Alloc = allocator<_Tp>>
std::list< _Tp, _Alloc >::list | ( | const list< _Tp, _Alloc > & | __x | ) | `[inline]`

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

References std::list< _Tp, _Alloc >::begin() , std::list< _Tp, _Alloc >::get_allocator() , and std::list< _Tp, _Alloc >::insert() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
template<typename _InputIterator>
std::list< _Tp, _Alloc >::list | ( | _InputIterator | __first,
|  | _InputIterator | __last,
|  | const allocator_type & | __a = allocator_type()
| ) | `[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)).

Definition at line 503 of file stl_list.h.

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

template<typename _Tp, typename _Alloc = allocator<_Tp>>
std::list< _Tp, _Alloc >::~list | ( |  | ) | `[inline]`

| The 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 responsibilty. Definition at line 513 of file stl_list.h.

## Member Function Documentation

template<typename _Tp, typename _Alloc = allocator<_Tp>>
template<typename _InputIterator>
void std::list< _Tp, _Alloc >::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.

Definition at line 552 of file stl_list.h.

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::assign | ( | size_type | __n,
|  | const value_type & | __val
| ) | `[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.

Definition at line 536 of file stl_list.h.

template<typename _Tp, typename _Alloc = allocator<_Tp>>
const_reference std::list< _Tp, _Alloc >::back | ( |  | ) | const`[inline]`

| Returns a read-only (constant) reference to the data at the last element of the %list. Definition at line 690 of file stl_list.h. References std::list< _Tp, _Alloc >::end() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
reference std::list< _Tp, _Alloc >::back | ( |  | ) | `[inline]`

| Returns a read/write reference to the data at the last element of the %list. Definition at line 683 of file stl_list.h. References std::list< _Tp, _Alloc >::end() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
const_iterator std::list< _Tp, _Alloc >::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. Definition at line 576 of file stl_list.h.

template<typename _Tp, typename _Alloc = allocator<_Tp>>
iterator std::list< _Tp, _Alloc >::begin | ( |  | ) | `[inline]`

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

Definition at line 569 of file stl_list.h.

Referenced by std::list< _Tp, _Alloc >::front() , std::list< _Tp, _Alloc >::list() , std::list< _Tp, _Alloc >::merge() , std::list< _Tp, _Alloc >::operator=() , std::operator==() , std::list< _Tp, _Alloc >::pop_front() , std::list< _Tp, _Alloc >::push_front() , std::list< _Tp, _Alloc >::remove_if() , std::list< _Tp, _Alloc >::rend() , std::list< _Tp, _Alloc >::resize() , std::list< _Tp, _Alloc >::size() , std::list< _Tp, _Alloc >::sort() , std::list< _Tp, _Alloc >::splice() , and std::list< _Tp, _Alloc >::unique() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::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. Definition at line 919 of file stl_list.h.

template<typename _Tp, typename _Alloc = allocator<_Tp>>
bool std::list< _Tp, _Alloc >::empty | ( |  | ) | const`[inline]`

| Returns true if the %list is empty. (Thus begin() would equal end().) Definition at line 628 of file stl_list.h. Referenced by std::list< _Tp, _Alloc >::sort() , and std::list< _Tp, _Alloc >::splice() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
const_iterator std::list< _Tp, _Alloc >::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. Definition at line 590 of file stl_list.h.

template<typename _Tp, typename _Alloc = allocator<_Tp>>
iterator std::list< _Tp, _Alloc >::end | ( |  | ) | `[inline]`

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

Referenced by std::list< _Tp, _Alloc >::back() , std::list< _Tp, _Alloc >::merge() , std::list< _Tp, _Alloc >::operator=() , std::operator==() , std::list< _Tp, _Alloc >::pop_back() , std::list< _Tp, _Alloc >::push_back() , std::list< _Tp, _Alloc >::rbegin() , std::list< _Tp, _Alloc >::remove_if() , std::list< _Tp, _Alloc >::resize() , std::list< _Tp, _Alloc >::size() , std::list< _Tp, _Alloc >::splice() , and std::list< _Tp, _Alloc >::unique() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
iterator std::list< _Tp, _Alloc >::erase | ( | iterator | __first,
|  | iterator | __last
| ) | `[inline]`

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.

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

References std::list< _Tp, _Alloc >::erase() .

template<typename _Tp, typename _Alloc>
list< _Tp, _Alloc >::iterator std::list< _Tp, _Alloc >::erase | ( | iterator | __position | ) |

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.

Definition at line 100 of file list.tcc.

Referenced by std::list< _Tp, _Alloc >::erase() , std::list< _Tp, _Alloc >::operator=() , std::list< _Tp, _Alloc >::pop_back() , std::list< _Tp, _Alloc >::pop_front() , std::list< _Tp, _Alloc >::remove_if() , std::list< _Tp, _Alloc >::resize() , and std::list< _Tp, _Alloc >::unique() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
const_reference std::list< _Tp, _Alloc >::front | ( |  | ) | const`[inline]`

| Returns a read-only (constant) reference to the data at the first element of the %list. Definition at line 676 of file stl_list.h. References std::list< _Tp, _Alloc >::begin() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
reference std::list< _Tp, _Alloc >::front | ( |  | ) | `[inline]`

| Returns a read/write reference to the data at the first element of the %list. Definition at line 669 of file stl_list.h. References std::list< _Tp, _Alloc >::begin() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
allocator_type std::list< _Tp, _Alloc >::get_allocator | ( |  | ) | const`[inline]`

| Get a copy of the memory allocation object. Definition at line 561 of file stl_list.h. Referenced by std::list< _Tp, _Alloc >::list() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
template<typename _InputIterator>
void std::list< _Tp, _Alloc >::insert | ( | iterator | __pos,
|  | _InputIterator | __first,
|  | _InputIterator | __last
| ) | `[inline]`

Inserts a range into the %list.

Parameters:

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

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

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::insert | ( | iterator | __pos,
|  | size_type | __n,
|  | const value_type & | __x
| ) | `[inline]`

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.

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

template<typename _Tp, typename _Alloc = allocator<_Tp>>
iterator std::list< _Tp, _Alloc >::insert | ( | iterator | __position | ) | `[inline]`

Inserts an element into the %list.

Parameters:

  position | An iterator into the %list.

Returns:
  An iterator that points to the inserted element.

This function will insert a default-constructed element before the specified location. You should consider using insert(position,value_type()) instead. Due to the nature of a %list this operation can be done in constant time, and does not invalidate iterators and references.

Note:
  This was deprecated in 3.2 and will be removed in 3.4. You must define `_GLIBCPP_DEPRECATED` to make this visible in 3.2; see c++config.h.

Definition at line 814 of file stl_list.h.

References std::list< _Tp, _Alloc >::insert() .

template<typename _Tp, typename _Alloc>
list< _Tp, _Alloc >::iterator std::list< _Tp, _Alloc >::insert | ( | iterator | __position,
|  | const value_type & | __x
| ) |

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.

Definition at line 87 of file list.tcc.

Referenced by std::list< _Tp, _Alloc >::insert() , std::list< _Tp, _Alloc >::list() , std::list< _Tp, _Alloc >::operator=() , std::list< _Tp, _Alloc >::push_back() , std::list< _Tp, _Alloc >::push_front() , and std::list< _Tp, _Alloc >::resize() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
size_type std::list< _Tp, _Alloc >::max_size | ( |  | ) | const`[inline]`

| Returns the size() of the largest possible %list. Definition at line 636 of file stl_list.h.

template<typename _Tp, typename _Alloc>
template<typename _StrictWeakOrdering>
void std::list< _Tp, _Alloc >::merge | ( | list< _Tp, _Alloc > & | ,
|  | _StrictWeakOrdering |
| ) |

Todo:
  Doc me! See docs/doxygen/TODO and http://gcc.gnu.org/ml/libstdc++/2002-02/msg00003.html for more.

Definition at line 318 of file list.tcc.

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

template<typename _Tp, typename _Alloc>
void std::list< _Tp, _Alloc >::merge | ( | list< _Tp, _Alloc > & | __x | ) |

Todo:
  Doc me! See docs/doxygen/TODO and http://gcc.gnu.org/ml/libstdc++/2002-02/msg00003.html for more.

Definition at line 217 of file list.tcc.

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

Referenced by std::list< _Tp, _Alloc >::sort() .

template<typename _Tp, typename _Alloc>
list< _Tp, _Alloc > & std::list< _Tp, _Alloc >::operator= | ( | const list< _Tp, _Alloc > & | __x | ) |

%List assignment operator.

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.

Definition at line 130 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() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::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.

Definition at line 777 of file stl_list.h.

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

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::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.

Definition at line 734 of file stl_list.h.

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

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::push_back | ( |  | ) | `[inline]`

Add data to the end of the %list.

This is a typical stack operation. The function creates a default-constructed element at the end of the %list. Due to the nature of a %list this operation can be done in constant time. You should consider using push_back(value_type()) instead.

Note:
  This was deprecated in 3.2 and will be removed in 3.4. You must define `_GLIBCPP_DEPRECATED` to make this visible in 3.2; see c++config.h.

Definition at line 762 of file stl_list.h.

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

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::push_back | ( | const value_type & | __x | ) | `[inline]`

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

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

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::push_front | ( |  | ) | `[inline]`

Add data to the front of the %list.

This is a typical stack operation. The function creates a default-constructed element at the front of the %list. Due to the nature of a %list this operation can be done in constant time. You should consider using push_front(value_type()) instead.

Note:
  This was deprecated in 3.2 and will be removed in 3.4. You must define `_GLIBCPP_DEPRECATED` to make this visible in 3.2; see c++config.h.

Definition at line 719 of file stl_list.h.

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

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::push_front | ( | const value_type & | __x | ) | `[inline]`

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

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

template<typename _Tp, typename _Alloc = allocator<_Tp>>
const_reverse_iterator std::list< _Tp, _Alloc >::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. Definition at line 604 of file stl_list.h. References std::list< _Tp, _Alloc >::end() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
reverse_iterator std::list< _Tp, _Alloc >::rbegin | ( |  | ) | `[inline]`

| 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 597 of file stl_list.h. References std::list< _Tp, _Alloc >::end() .

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

Todo:
  Doc me! See docs/doxygen/TODO and http://gcc.gnu.org/ml/libstdc++/2002-02/msg00003.html for more.

template<typename _Tp, typename _Alloc>
template<typename _Predicate>
void std::list< _Tp, _Alloc >::remove_if | ( | _Predicate |  | ) |

Todo:
  Doc me! See docs/doxygen/TODO and http://gcc.gnu.org/ml/libstdc++/2002-02/msg00003.html for more.

Definition at line 281 of file list.tcc.

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

template<typename _Tp, typename _Alloc = allocator<_Tp>>
const_reverse_iterator std::list< _Tp, _Alloc >::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. Definition at line 620 of file stl_list.h. References std::list< _Tp, _Alloc >::begin() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
reverse_iterator std::list< _Tp, _Alloc >::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. Definition at line 612 of file stl_list.h. References std::list< _Tp, _Alloc >::begin() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::resize | ( | size_type | __new_size | ) | `[inline]`

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 the %list is extended and new elements are default-constructed.

Definition at line 661 of file stl_list.h.

References std::list< _Tp, _Alloc >::resize() .

template<typename _Tp, typename _Alloc>
void std::list< _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.

Definition at line 115 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() .

Referenced by std::list< _Tp, _Alloc >::resize() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::reverse | ( |  | ) | `[inline]`

Todo:
  Doc me! See docs/doxygen/TODO and http://gcc.gnu.org/ml/libstdc++/2002-02/msg00003.html for more.

Definition at line 997 of file stl_list.h.

template<typename _Tp, typename _Alloc = allocator<_Tp>>
size_type std::list< _Tp, _Alloc >::size | ( |  | ) | const`[inline]`

| Returns the number of elements in the %list. Definition at line 632 of file stl_list.h. References std::list< _Tp, _Alloc >::begin() , __gnu_cxx::distance() , and std::list< _Tp, _Alloc >::end() .

template<typename _Tp, typename _Alloc>
template<typename _StrictWeakOrdering>
void std::list< _Tp, _Alloc >::sort | ( | _StrictWeakOrdering |  | ) |

Todo:
  Doc me! See docs/doxygen/TODO and http://gcc.gnu.org/ml/libstdc++/2002-02/msg00003.html for more.

Definition at line 340 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() .

template<typename _Tp, typename _Alloc>
void std::list< _Tp, _Alloc >::sort | ( |  | ) |

Todo:
  Doc me! See docs/doxygen/TODO and http://gcc.gnu.org/ml/libstdc++/2002-02/msg00003.html for more.

Definition at line 250 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() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::splice | ( | iterator | __position,
|  | list< _Tp, _Alloc > & | ,
|  | iterator | __first,
|  | iterator | __last
| ) | `[inline]`

Todo:
  Doc me! See docs/doxygen/TODO and http://gcc.gnu.org/ml/libstdc++/2002-02/msg00003.html for more.

Definition at line 948 of file stl_list.h.

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::splice | ( | iterator | __position,
|  | list< _Tp, _Alloc > & | ,
|  | iterator | __i
| ) | `[inline]`

Todo:
  Doc me! See docs/doxygen/TODO and http://gcc.gnu.org/ml/libstdc++/2002-02/msg00003.html for more.

Definition at line 936 of file stl_list.h.

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::splice | ( | iterator | __position,
|  | list< _Tp, _Alloc > & | __x
| ) | `[inline]`

Todo:
  Doc me! See docs/doxygen/TODO and http://gcc.gnu.org/ml/libstdc++/2002-02/msg00003.html for more.

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::list< _Tp, _Alloc >::sort() .

template<typename _Tp, typename _Alloc = allocator<_Tp>>
void std::list< _Tp, _Alloc >::swap | ( | list< _Tp, _Alloc > & | __x | ) | `[inline]`

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. (It is only swapping a single pointer, so it should be quite fast.) Note that the global std::swap() function is specialized such that std::swap(l1,l2) will feed to this function.

Definition at line 910 of file stl_list.h.

References std::swap() .

Referenced by std::list< _Tp, _Alloc >::sort() , and std::swap() .

template<typename _Tp, typename _Alloc>
template<typename _BinaryPredicate>
void std::list< _Tp, _Alloc >::unique | ( | _BinaryPredicate |  | ) |

Todo:
  Doc me! See docs/doxygen/TODO and http://gcc.gnu.org/ml/libstdc++/2002-02/msg00003.html for more.

Definition at line 298 of file list.tcc.

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

template<typename _Tp, typename _Alloc>
void std::list< _Tp, _Alloc >::unique | ( |  | ) |

Todo:
  Doc me! See docs/doxygen/TODO and http://gcc.gnu.org/ml/libstdc++/2002-02/msg00003.html for more.

Definition at line 198 of file list.tcc.

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

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

- stl_list.h
- list.tcc