Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::container::list< T, Allocator > Class Template Reference

A list is a doubly linked list. More...

#include <list.hpp>

Inheritance diagram for boost::container::list< T, Allocator >:
Collaboration diagram for boost::container::list< T, Allocator >:

Public Types

typedef T value_type
 
typedef
::boost::container::allocator_traits
< Allocator >::pointer 
pointer
 
typedef
::boost::container::allocator_traits
< Allocator >::const_pointer 
const_pointer
 
typedef
::boost::container::allocator_traits
< Allocator >::reference 
reference
 
typedef
::boost::container::allocator_traits
< Allocator >::const_reference 
const_reference
 
typedef
::boost::container::allocator_traits
< Allocator >::size_type 
size_type
 
typedef
::boost::container::allocator_traits
< Allocator >::difference_type 
difference_type
 
typedef Allocator allocator_type
 

Public Member Functions

typedef BOOST_CONTAINER_IMPDEF (NodeAlloc) stored_allocator_type
 
typedef BOOST_CONTAINER_IMPDEF (iterator_impl) iterator
 
typedef BOOST_CONTAINER_IMPDEF (const_iterator_impl) const _iterator
 
typedef BOOST_CONTAINER_IMPDEF (container_detail::reverse_iterator< iterator >) reverse_iterator
 
typedef BOOST_CONTAINER_IMPDEF (container_detail::reverse_iterator< const_iterator >) const _reverse_iterator
 
 list ()
 Effects: Default constructs a list. More...
 
 list (const allocator_type &a) BOOST_CONTAINER_NOEXCEPT
 Effects: Constructs a list taking the allocator as parameter. More...
 
 list (size_type n)
 Effects: Constructs a list that will use a copy of allocator a and inserts n copies of value. More...
 
 list (size_type n, const T &value, const Allocator &a=Allocator())
 Effects: Constructs a list that will use a copy of allocator a and inserts n copies of value. More...
 
 list (const list &x)
 Effects: Copy constructs a list. More...
 
 list (BOOST_RV_REF(list) x)
 Effects: Move constructor. More...
 
 list (const list &x, const allocator_type &a)
 Effects: Copy constructs a list using the specified allocator. More...
 
 list (BOOST_RV_REF(list) x, const allocator_type &a)
 Effects: Move constructor sing the specified allocator. More...
 
template<class InpIt >
 list (InpIt first, InpIt last, const Allocator &a=Allocator())
 Effects: Constructs a list that will use a copy of allocator a and inserts a copy of the range [first, last) in the list. More...
 
 list (std::initializer_list< value_type > il, const Allocator &a=Allocator())
 Effects: Constructs a list that will use a copy of allocator a and inserts a copy of the range [il.begin(), il.end()) in the list. More...
 
 ~list () BOOST_CONTAINER_NOEXCEPT
 Effects: Destroys the list. More...
 
listoperator= (BOOST_COPY_ASSIGN_REF(list) x)
 Effects: Makes *this contain the same elements as x. More...
 
listoperator= (BOOST_RV_REF(list) x) BOOST_CONTAINER_NOEXCEPT_IF(allocator_traits_type
 Effects: Move assignment. More...
 
listoperator= (std::initializer_list< value_type > il)
 Effects: Makes *this contain the same elements as il. More...
 
void assign (size_type n, const T &val)
 Effects: Assigns the n copies of val to *this. More...
 
template<class InpIt >
void assign (InpIt first, InpIt last, typename container_detail::enable_if_c< !container_detail::is_convertible< InpIt, size_type >::value >::type *=0)
 Effects: Assigns the the range [first, last) to *this. More...
 
void assign (std::initializer_list< value_type > il)
 Effects: Assigns the the range [il.begin(), il.end()) to *this. More...
 
allocator_type get_allocator () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a copy of the internal allocator. More...
 
stored_allocator_type & get_stored_allocator () BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a reference to the internal allocator. More...
 
const stored_allocator_type & get_stored_allocator () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a reference to the internal allocator. More...
 
iterator begin () BOOST_CONTAINER_NOEXCEPT
 Effects: Returns an iterator to the first element contained in the list. More...
 
const_iterator begin () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_iterator to the first element contained in the list. More...
 
iterator end () BOOST_CONTAINER_NOEXCEPT
 Effects: Returns an iterator to the end of the list. More...
 
const_iterator end () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_iterator to the end of the list. More...
 
reverse_iterator rbegin () BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a reverse_iterator pointing to the beginning of the reversed list. More...
 
const_reverse_iterator rbegin () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed list. More...
 
reverse_iterator rend () BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a reverse_iterator pointing to the end of the reversed list. More...
 
const_reverse_iterator rend () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_reverse_iterator pointing to the end of the reversed list. More...
 
const_iterator cbegin () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_iterator to the first element contained in the list. More...
 
const_iterator cend () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_iterator to the end of the list. More...
 
const_reverse_iterator crbegin () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed list. More...
 
const_reverse_iterator crend () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_reverse_iterator pointing to the end of the reversed list. More...
 
bool empty () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns true if the list contains no elements. More...
 
size_type size () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns the number of the elements contained in the list. More...
 
size_type max_size () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns the largest possible size of the list. More...
 
void resize (size_type new_size)
 Effects: Inserts or erases elements at the end such that the size becomes n. More...
 
void resize (size_type new_size, const T &x)
 Effects: Inserts or erases elements at the end such that the size becomes n. More...
 
reference front () BOOST_CONTAINER_NOEXCEPT
 Requires: !empty() More...
 
const_reference front () const BOOST_CONTAINER_NOEXCEPT
 Requires: !empty() More...
 
reference back () BOOST_CONTAINER_NOEXCEPT
 Requires: !empty() More...
 
const_reference back () const BOOST_CONTAINER_NOEXCEPT
 Requires: !empty() More...
 
iterator insert (const_iterator p, size_type n, const T &x)
 Requires: p must be a valid iterator of *this. More...
 
template<class InpIt >
iterator insert (const_iterator p, InpIt first, InpIt last, typename container_detail::enable_if_c< !container_detail::is_convertible< InpIt, size_type >::value &&(container_detail::is_input_iterator< InpIt >::value||container_detail::is_same< alloc_version, allocator_v1 >::value) >::type *=0)
 Requires: p must be a valid iterator of *this. More...
 
template<class FwdIt >
iterator insert (const_iterator p, FwdIt first, FwdIt last, typename container_detail::enable_if_c< !container_detail::is_convertible< FwdIt, size_type >::value &&!(container_detail::is_input_iterator< FwdIt >::value||container_detail::is_same< alloc_version, allocator_v1 >::value) >::type *=0)
 
iterator insert (const_iterator p, std::initializer_list< value_type > il)
 Requires: p must be a valid iterator of *this. More...
 
void pop_front () BOOST_CONTAINER_NOEXCEPT
 Effects: Removes the first element from the list. More...
 
void pop_back () BOOST_CONTAINER_NOEXCEPT
 Effects: Removes the last element from the list. More...
 
iterator erase (const_iterator p) BOOST_CONTAINER_NOEXCEPT
 Requires: p must be a valid iterator of *this. More...
 
iterator erase (const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
 Requires: first and last must be valid iterator to elements in *this. More...
 
void swap (list &x)
 Effects: Swaps the contents of *this and x. More...
 
void clear () BOOST_CONTAINER_NOEXCEPT
 Effects: Erases all the elements of the list. More...
 
void splice (const_iterator p, list &x) BOOST_CONTAINER_NOEXCEPT
 Requires: p must point to an element contained by the list. More...
 
void splice (const_iterator p, BOOST_RV_REF(list) x) BOOST_CONTAINER_NOEXCEPT
 Requires: p must point to an element contained by the list. More...
 
void splice (const_iterator p, list &x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
 Requires: p must point to an element contained by this list. More...
 
void splice (const_iterator p, BOOST_RV_REF(list) x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
 Requires: p must point to an element contained by this list. More...
 
void splice (const_iterator p, list &x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
 Requires: p must point to an element contained by this list. More...
 
void splice (const_iterator p, BOOST_RV_REF(list) x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
 Requires: p must point to an element contained by this list. More...
 
void splice (const_iterator p, list &x, const_iterator first, const_iterator last, size_type n) BOOST_CONTAINER_NOEXCEPT
 Requires: p must point to an element contained by this list. More...
 
void splice (const_iterator p, BOOST_RV_REF(list) x, const_iterator first, const_iterator last, size_type n) BOOST_CONTAINER_NOEXCEPT
 Requires: p must point to an element contained by this list. More...
 
void remove (const T &value)
 Effects: Removes all the elements that compare equal to value. More...
 
template<class Pred >
void remove_if (Pred pred)
 Effects: Removes all the elements for which a specified predicate is satisfied. More...
 
void unique ()
 Effects: Removes adjacent duplicate elements or adjacent elements that are equal from the list. More...
 
template<class BinaryPredicate >
void unique (BinaryPredicate binary_pred)
 Effects: Removes adjacent duplicate elements or adjacent elements that satisfy some binary predicate from the list. More...
 
void merge (list &x)
 Requires: The lists x and *this must be distinct. More...
 
void merge (BOOST_RV_REF(list) x)
 Requires: The lists x and *this must be distinct. More...
 
template<class StrictWeakOrdering >
void merge (list &x, const StrictWeakOrdering &comp)
 Requires: p must be a comparison function that induces a strict weak ordering and both *this and x must be sorted according to that ordering The lists x and *this must be distinct. More...
 
template<class StrictWeakOrdering >
void merge (BOOST_RV_REF(list) x, StrictWeakOrdering comp)
 Requires: p must be a comparison function that induces a strict weak ordering and both *this and x must be sorted according to that ordering The lists x and *this must be distinct. More...
 
void sort ()
 Effects: This function sorts the list *this according to std::less<value_type>. More...
 
template<class StrictWeakOrdering >
void sort (StrictWeakOrdering comp)
 Effects: This function sorts the list *this according to std::less<value_type>. More...
 
void reverse () BOOST_CONTAINER_NOEXCEPT
 Effects: Reverses the order of elements in the list. More...
 

Friends

class insertion_functor
 
bool operator== (const list &x, const list &y)
 Effects: Returns true if x and y are equal More...
 
bool operator!= (const list &x, const list &y)
 Effects: Returns true if x and y are unequal More...
 
bool operator< (const list &x, const list &y)
 Effects: Returns true if x is less than y More...
 
bool operator> (const list &x, const list &y)
 Effects: Returns true if x is greater than y More...
 
bool operator<= (const list &x, const list &y)
 Effects: Returns true if x is equal or less than y More...
 
bool operator>= (const list &x, const list &y)
 Effects: Returns true if x is equal or greater than y More...
 
void swap (list &x, list &y)
 Effects: x.swap(y) More...
 

Detailed Description

template<class T, class Allocator>
class boost::container::list< T, Allocator >

A list is a doubly linked list.

That is, it is a Sequence that supports both forward and backward traversal, and (amortized) constant time insertion and removal of elements at the beginning or the end, or in the middle. Lists have the important property that insertion and splicing do not invalidate iterators to list elements, and that even removal invalidates only the iterators that point to the elements that are removed. The ordering of iterators may be changed (that is, list<T>::iterator might have a different predecessor or successor after a list operation than it did before), but the iterators themselves will not be invalidated or made to point to different elements unless that invalidation or mutation is explicit.

Template Parameters
TThe type of object that is stored in the list
AllocatorThe allocator used for all internal memory management

Member Typedef Documentation

template<class T , class Allocator >
typedef Allocator boost::container::list< T, Allocator >::allocator_type
template<class T , class Allocator >
typedef ::boost::container::allocator_traits<Allocator>::const_pointer boost::container::list< T, Allocator >::const_pointer
template<class T , class Allocator >
typedef ::boost::container::allocator_traits<Allocator>::const_reference boost::container::list< T, Allocator >::const_reference
template<class T , class Allocator >
typedef ::boost::container::allocator_traits<Allocator>::difference_type boost::container::list< T, Allocator >::difference_type
template<class T , class Allocator >
typedef ::boost::container::allocator_traits<Allocator>::pointer boost::container::list< T, Allocator >::pointer
template<class T , class Allocator >
typedef ::boost::container::allocator_traits<Allocator>::reference boost::container::list< T, Allocator >::reference
template<class T , class Allocator >
typedef ::boost::container::allocator_traits<Allocator>::size_type boost::container::list< T, Allocator >::size_type
template<class T , class Allocator >
typedef T boost::container::list< T, Allocator >::value_type

Constructor & Destructor Documentation

template<class T , class Allocator >
boost::container::list< T, Allocator >::list ( )
inline

Effects: Default constructs a list.

Throws: If allocator_type's default constructor throws.

Complexity: Constant.

template<class T , class Allocator >
boost::container::list< T, Allocator >::list ( const allocator_type a)
inlineexplicit

Effects: Constructs a list taking the allocator as parameter.

Throws: Nothing

Complexity: Constant.

template<class T , class Allocator >
boost::container::list< T, Allocator >::list ( size_type  n)
inlineexplicit

Effects: Constructs a list that will use a copy of allocator a and inserts n copies of value.

Throws: If allocator_type's default constructor throws or T's default or copy constructor throws.

Complexity: Linear to n.

References boost::container::list< T, Allocator >::resize().

template<class T , class Allocator >
boost::container::list< T, Allocator >::list ( size_type  n,
const T value,
const Allocator &  a = Allocator() 
)
inline

Effects: Constructs a list that will use a copy of allocator a and inserts n copies of value.

Throws: If allocator_type's default constructor throws or T's default or copy constructor throws.

Complexity: Linear to n.

References boost::container::list< T, Allocator >::cbegin(), and boost::container::list< T, Allocator >::insert().

template<class T , class Allocator >
boost::container::list< T, Allocator >::list ( const list< T, Allocator > &  x)
inline

Effects: Copy constructs a list.

Postcondition: x == *this.

Throws: If allocator_type's default constructor throws.

Complexity: Linear to the elements x contains.

References boost::container::list< T, Allocator >::begin(), boost::container::list< T, Allocator >::cbegin(), boost::container::list< T, Allocator >::end(), and boost::container::list< T, Allocator >::insert().

template<class T , class Allocator >
boost::container::list< T, Allocator >::list ( BOOST_RV_REF(list< T, Allocator >)  x)
inline

Effects: Move constructor.

Moves mx's resources to *this.

Throws: If allocator_type's copy constructor throws.

Complexity: Constant.

template<class T , class Allocator >
boost::container::list< T, Allocator >::list ( const list< T, Allocator > &  x,
const allocator_type a 
)
inline

Effects: Copy constructs a list using the specified allocator.

Postcondition: x == *this.

Throws: If allocator_type's default constructor or copy constructor throws.

Complexity: Linear to the elements x contains.

References boost::container::list< T, Allocator >::begin(), boost::container::list< T, Allocator >::cbegin(), boost::container::list< T, Allocator >::end(), and boost::container::list< T, Allocator >::insert().

template<class T , class Allocator >
boost::container::list< T, Allocator >::list ( BOOST_RV_REF(list< T, Allocator >)  x,
const allocator_type a 
)
inline

Effects: Move constructor sing the specified allocator.

Moves mx's resources to *this.

Throws: If allocation or value_type's copy constructor throws.

Complexity: Constant if a == x.get_allocator(), linear otherwise.

References boost::container::list< T, Allocator >::begin(), boost::container::list< T, Allocator >::cbegin(), boost::container::list< T, Allocator >::end(), and boost::container::list< T, Allocator >::insert().

template<class T , class Allocator >
template<class InpIt >
boost::container::list< T, Allocator >::list ( InpIt  first,
InpIt  last,
const Allocator &  a = Allocator() 
)
inline

Effects: Constructs a list that will use a copy of allocator a and inserts a copy of the range [first, last) in the list.

Throws: If allocator_type's default constructor throws or T's constructor taking a dereferenced InIt throws.

Complexity: Linear to the range [first, last).

References boost::container::list< T, Allocator >::cbegin(), and boost::container::list< T, Allocator >::insert().

template<class T , class Allocator >
boost::container::list< T, Allocator >::list ( std::initializer_list< value_type il,
const Allocator &  a = Allocator() 
)
inline

Effects: Constructs a list that will use a copy of allocator a and inserts a copy of the range [il.begin(), il.end()) in the list.

Throws: If allocator_type's default constructor throws or T's constructor taking a dereferenced std::initializer_list iterator throws.

Complexity: Linear to the range [il.begin(), il.end()).

template<class T , class Allocator >
boost::container::list< T, Allocator >::~list ( )
inline

Effects: Destroys the list.

All stored values are destroyed and used memory is deallocated.

Throws: Nothing.

Complexity: Linear to the number of elements.

Member Function Documentation

template<class T , class Allocator >
void boost::container::list< T, Allocator >::assign ( size_type  n,
const T val 
)
inline

Effects: Assigns the n copies of val to *this.

Throws: If memory allocation throws or T's copy constructor throws.

Complexity: Linear to n.

Referenced by boost::container::list< T, Allocator >::operator=().

template<class T , class Allocator >
template<class InpIt >
void boost::container::list< T, Allocator >::assign ( InpIt  first,
InpIt  last,
typename container_detail::enable_if_c< !container_detail::is_convertible< InpIt, size_type >::value >::type = 0 
)
inline

Effects: Assigns the the range [first, last) to *this.

Throws: If memory allocation throws or T's constructor from dereferencing InpIt throws.

Complexity: Linear to n.

References boost::container::list< T, Allocator >::begin(), boost::container::list< T, Allocator >::end(), boost::container::list< T, Allocator >::erase(), boost::xpressive::first, boost::container::list< T, Allocator >::insert(), and boost::last.

template<class T , class Allocator >
void boost::container::list< T, Allocator >::assign ( std::initializer_list< value_type il)
inline

Effects: Assigns the the range [il.begin(), il.end()) to *this.

Throws: If memory allocation throws or T's constructor from dereferencing std::initializer_list iterator throws.

Complexity: Linear to n.

template<class T , class Allocator >
reference boost::container::list< T, Allocator >::back ( )
inline

Requires: !empty()

Effects: Returns a reference to the first element from the beginning of the container.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::end().

template<class T , class Allocator >
const_reference boost::container::list< T, Allocator >::back ( ) const
inline

Requires: !empty()

Effects: Returns a const reference to the first element from the beginning of the container.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::end().

template<class T , class Allocator >
iterator boost::container::list< T, Allocator >::begin ( )
inline
template<class T , class Allocator >
const_iterator boost::container::list< T, Allocator >::begin ( ) const
inline

Effects: Returns a const_iterator to the first element contained in the list.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::cbegin().

template<class T , class Allocator >
typedef boost::container::list< T, Allocator >::BOOST_CONTAINER_IMPDEF ( NodeAlloc  )
template<class T , class Allocator >
typedef boost::container::list< T, Allocator >::BOOST_CONTAINER_IMPDEF ( iterator_impl  )
template<class T , class Allocator >
typedef boost::container::list< T, Allocator >::BOOST_CONTAINER_IMPDEF ( const_iterator_impl  ) const
template<class T , class Allocator >
typedef boost::container::list< T, Allocator >::BOOST_CONTAINER_IMPDEF ( container_detail::reverse_iterator< iterator >  )
template<class T , class Allocator >
typedef boost::container::list< T, Allocator >::BOOST_CONTAINER_IMPDEF ( container_detail::reverse_iterator< const_iterator >  ) const
template<class T , class Allocator >
const_iterator boost::container::list< T, Allocator >::cbegin ( ) const
inline
template<class T , class Allocator >
const_iterator boost::container::list< T, Allocator >::cend ( ) const
inline
template<class T , class Allocator >
void boost::container::list< T, Allocator >::clear ( )
inline

Effects: Erases all the elements of the list.

Throws: Nothing.

Complexity: Linear to the number of elements in the list.

References boost::fusion::clear().

Referenced by boost::container::list< T, Allocator >::operator=().

template<class T , class Allocator >
const_reverse_iterator boost::container::list< T, Allocator >::crbegin ( ) const
inline

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed list.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::cend().

Referenced by boost::container::list< T, Allocator >::rbegin().

template<class T , class Allocator >
const_reverse_iterator boost::container::list< T, Allocator >::crend ( ) const
inline

Effects: Returns a const_reverse_iterator pointing to the end of the reversed list.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::cbegin().

Referenced by boost::container::list< T, Allocator >::rend().

template<class T , class Allocator >
bool boost::container::list< T, Allocator >::empty ( ) const
inline

Effects: Returns true if the list contains no elements.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::size().

template<class T , class Allocator >
const_iterator boost::container::list< T, Allocator >::end ( ) const
inline

Effects: Returns a const_iterator to the end of the list.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::cend().

template<class T , class Allocator >
iterator boost::container::list< T, Allocator >::erase ( const_iterator  p)
inline

Requires: p must be a valid iterator of *this.

Effects: Erases the element at p p.

Throws: Nothing.

Complexity: Amortized constant time.

Referenced by boost::container::list< T, Allocator >::assign(), boost::container::list< T, Allocator >::pop_back(), and boost::container::list< T, Allocator >::pop_front().

template<class T , class Allocator >
iterator boost::container::list< T, Allocator >::erase ( const_iterator  first,
const_iterator  last 
)
inline

Requires: first and last must be valid iterator to elements in *this.

Effects: Erases the elements pointed by [first, last).

Throws: Nothing.

Complexity: Linear to the distance between first and last.

References boost::algorithm::erase_range().

template<class T , class Allocator >
reference boost::container::list< T, Allocator >::front ( )
inline

Requires: !empty()

Effects: Returns a reference to the first element from the beginning of the container.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::begin().

template<class T , class Allocator >
const_reference boost::container::list< T, Allocator >::front ( ) const
inline

Requires: !empty()

Effects: Returns a const reference to the first element from the beginning of the container.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::begin().

template<class T , class Allocator >
allocator_type boost::container::list< T, Allocator >::get_allocator ( ) const
inline

Effects: Returns a copy of the internal allocator.

Throws: If allocator's copy constructor throws.

Complexity: Constant.

template<class T , class Allocator >
stored_allocator_type& boost::container::list< T, Allocator >::get_stored_allocator ( )
inline

Effects: Returns a reference to the internal allocator.

Throws: Nothing

Complexity: Constant.

Note: Non-standard extension.

template<class T , class Allocator >
const stored_allocator_type& boost::container::list< T, Allocator >::get_stored_allocator ( ) const
inline

Effects: Returns a reference to the internal allocator.

Throws: Nothing

Complexity: Constant.

Note: Non-standard extension.

template<class T , class Allocator >
iterator boost::container::list< T, Allocator >::insert ( const_iterator  p,
size_type  n,
const T x 
)
inline

Requires: p must be a valid iterator of *this.

Effects: Inserts n copies of x before p.

Returns: an iterator to the first inserted element or p if n is 0.

Throws: If memory allocation throws or T's copy constructor throws.

Complexity: Linear to n.

Referenced by boost::container::list< T, Allocator >::assign(), boost::container::list< T, Allocator >::insert(), boost::container::list< T, Allocator >::list(), and boost::container::list< T, Allocator >::resize().

template<class T , class Allocator >
template<class InpIt >
iterator boost::container::list< T, Allocator >::insert ( const_iterator  p,
InpIt  first,
InpIt  last,
typename container_detail::enable_if_c< !container_detail::is_convertible< InpIt, size_type >::value &&(container_detail::is_input_iterator< InpIt >::value||container_detail::is_same< alloc_version, allocator_v1 >::value) >::type = 0 
)
inline

Requires: p must be a valid iterator of *this.

Effects: Insert a copy of the [first, last) range before p.

Returns: an iterator to the first inserted element or p if first == last.

Throws: If memory allocation throws, T's constructor from a dereferenced InpIt throws.

Complexity: Linear to std::distance [first, last).

References boost::xpressive::first, boost::container::list< T, Allocator >::insert(), and boost::last.

template<class T , class Allocator >
template<class FwdIt >
iterator boost::container::list< T, Allocator >::insert ( const_iterator  p,
FwdIt  first,
FwdIt  last,
typename container_detail::enable_if_c< !container_detail::is_convertible< FwdIt, size_type >::value &&!(container_detail::is_input_iterator< FwdIt >::value||container_detail::is_same< alloc_version, allocator_v1 >::value) >::type = 0 
)
inline
template<class T , class Allocator >
iterator boost::container::list< T, Allocator >::insert ( const_iterator  p,
std::initializer_list< value_type il 
)
inline

Requires: p must be a valid iterator of *this.

Effects: Insert a copy of the [il.begin(), il.end()) range before p.

Returns: an iterator to the first inserted element or p if if.begin() == il.end().

Throws: If memory allocation throws, T's constructor from a dereferenced std::initializer_list iterator throws.

Complexity: Linear to std::distance [il.begin(), il.end()).

template<class T , class Allocator >
size_type boost::container::list< T, Allocator >::max_size ( ) const
inline

Effects: Returns the largest possible size of the list.

Throws: Nothing.

Complexity: Constant.

template<class T , class Allocator >
void boost::container::list< T, Allocator >::merge ( list< T, Allocator > &  x)
inline

Requires: The lists x and *this must be distinct.

Effects: This function removes all of x's elements and inserts them in order into *this according to std::less<value_type>. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

Throws: If comparison throws.

Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

Referenced by boost::container::list< T, Allocator >::merge().

template<class T , class Allocator >
void boost::container::list< T, Allocator >::merge ( BOOST_RV_REF(list< T, Allocator >)  x)
inline

Requires: The lists x and *this must be distinct.

Effects: This function removes all of x's elements and inserts them in order into *this according to std::less<value_type>. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

Throws: If comparison throws.

Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

References boost::container::list< T, Allocator >::merge().

template<class T , class Allocator >
template<class StrictWeakOrdering >
void boost::container::list< T, Allocator >::merge ( list< T, Allocator > &  x,
const StrictWeakOrdering &  comp 
)
inline

Requires: p must be a comparison function that induces a strict weak ordering and both *this and x must be sorted according to that ordering The lists x and *this must be distinct.

Effects: This function removes all of x's elements and inserts them in order into *this. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

Throws: If comp throws.

Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

Note: Iterators and references to *this are not invalidated.

References BOOST_ASSERT.

template<class T , class Allocator >
template<class StrictWeakOrdering >
void boost::container::list< T, Allocator >::merge ( BOOST_RV_REF(list< T, Allocator >)  x,
StrictWeakOrdering  comp 
)
inline

Requires: p must be a comparison function that induces a strict weak ordering and both *this and x must be sorted according to that ordering The lists x and *this must be distinct.

Effects: This function removes all of x's elements and inserts them in order into *this. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

Throws: If comp throws.

Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

Note: Iterators and references to *this are not invalidated.

References boost::container::list< T, Allocator >::merge().

template<class T , class Allocator >
list& boost::container::list< T, Allocator >::operator= ( BOOST_COPY_ASSIGN_REF(list< T, Allocator >)  x)
inline

Effects: Makes *this contain the same elements as x.

Postcondition: this->size() == x.size(). *this contains a copy of each of x's elements.

Throws: If memory allocation throws or T's copy constructor throws.

Complexity: Linear to the number of elements in x.

References boost::container::list< T, Allocator >::assign(), boost::container::list< T, Allocator >::begin(), boost::spirit::x3::bool_, boost::container::list< T, Allocator >::clear(), boost::container::list< T, Allocator >::end(), and boost::program_options::value().

template<class T , class Allocator >
list& boost::container::list< T, Allocator >::operator= ( BOOST_RV_REF(list< T, Allocator >)  x)
inline

Effects: Move assignment.

All x's values are transferred to *this.

Postcondition: x.empty(). *this contains a the elements x had before the function.

Throws: If allocator_traits_type::propagate_on_container_move_assignment is false and (allocation throws or value_type's move constructor throws)

Complexity: Constant if allocator_traits_type:: propagate_on_container_move_assignment is true or this->get>allocator() == x.get_allocator(). Linear otherwise.

References boost::container::list< T, Allocator >::assign(), BOOST_ASSERT, boost::container::list< T, Allocator >::clear(), boost::make_move_iterator(), boost::move(), boost::program_options::value(), boost::detail::void, and boost::flyweights::x.

template<class T , class Allocator >
list& boost::container::list< T, Allocator >::operator= ( std::initializer_list< value_type il)
inline

Effects: Makes *this contain the same elements as il.

Postcondition: this->size() == il.size(). *this contains a copy of each of x's elements.

Throws: If memory allocation throws or T's copy constructor throws.

Complexity: Linear to the number of elements in x.

template<class T , class Allocator >
void boost::container::list< T, Allocator >::pop_back ( )
inline

Effects: Removes the last element from the list.

Throws: Nothing.

Complexity: Amortized constant time.

References boost::container::list< T, Allocator >::cend(), and boost::container::list< T, Allocator >::erase().

template<class T , class Allocator >
void boost::container::list< T, Allocator >::pop_front ( )
inline

Effects: Removes the first element from the list.

Throws: Nothing.

Complexity: Amortized constant time.

References boost::container::list< T, Allocator >::cbegin(), and boost::container::list< T, Allocator >::erase().

template<class T , class Allocator >
reverse_iterator boost::container::list< T, Allocator >::rbegin ( )
inline

Effects: Returns a reverse_iterator pointing to the beginning of the reversed list.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::end().

template<class T , class Allocator >
const_reverse_iterator boost::container::list< T, Allocator >::rbegin ( ) const
inline

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed list.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::crbegin().

template<class T , class Allocator >
void boost::container::list< T, Allocator >::remove ( const T value)
inline

Effects: Removes all the elements that compare equal to value.

Throws: If comparison throws.

Complexity: Linear time. It performs exactly size() comparisons for equality.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

References boost::container::list< T, Allocator >::remove_if().

template<class T , class Allocator >
template<class Pred >
void boost::container::list< T, Allocator >::remove_if ( Pred  pred)
inline

Effects: Removes all the elements for which a specified predicate is satisfied.

Throws: If pred throws.

Complexity: Linear time. It performs exactly size() calls to the predicate.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

Referenced by boost::container::list< T, Allocator >::remove().

template<class T , class Allocator >
reverse_iterator boost::container::list< T, Allocator >::rend ( )
inline

Effects: Returns a reverse_iterator pointing to the end of the reversed list.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::begin().

template<class T , class Allocator >
const_reverse_iterator boost::container::list< T, Allocator >::rend ( ) const
inline

Effects: Returns a const_reverse_iterator pointing to the end of the reversed list.

Throws: Nothing.

Complexity: Constant.

References boost::container::list< T, Allocator >::crend().

template<class T , class Allocator >
void boost::container::list< T, Allocator >::resize ( size_type  new_size)
inline

Effects: Inserts or erases elements at the end such that the size becomes n.

New elements are value initialized.

Throws: If memory allocation throws, or T's copy constructor throws.

Complexity: Linear to the difference between size() and new_size.

References boost::container::list< T, Allocator >::cend(), boost::container::list< T, Allocator >::insert(), and boost::container::list< T, Allocator >::size().

Referenced by boost::container::list< T, Allocator >::list().

template<class T , class Allocator >
void boost::container::list< T, Allocator >::resize ( size_type  new_size,
const T x 
)
inline

Effects: Inserts or erases elements at the end such that the size becomes n.

New elements are copy constructed from x.

Throws: If memory allocation throws, or T's copy constructor throws.

Complexity: Linear to the difference between size() and new_size.

References boost::container::list< T, Allocator >::cend(), boost::container::list< T, Allocator >::insert(), and boost::container::list< T, Allocator >::size().

template<class T , class Allocator >
void boost::container::list< T, Allocator >::reverse ( )
inline

Effects: Reverses the order of elements in the list.

Throws: Nothing.

Complexity: This function is linear time.

Note: Iterators and references are not invalidated

template<class T , class Allocator >
size_type boost::container::list< T, Allocator >::size ( ) const
inline

Effects: Returns the number of the elements contained in the list.

Throws: Nothing.

Complexity: Constant.

Referenced by boost::container::list< T, Allocator >::empty(), boost::container::list< T, Allocator >::resize(), and boost::container::list< T, Allocator >::sort().

template<class T , class Allocator >
void boost::container::list< T, Allocator >::sort ( )
inline

Effects: This function sorts the list *this according to std::less<value_type>.

The sort is stable, that is, the relative order of equivalent elements is preserved.

Throws: If comparison throws.

Notes: Iterators and references are not invalidated.

Complexity: The number of comparisons is approximately N log N, where N is the list's size.

template<class T , class Allocator >
template<class StrictWeakOrdering >
void boost::container::list< T, Allocator >::sort ( StrictWeakOrdering  comp)
inline

Effects: This function sorts the list *this according to std::less<value_type>.

The sort is stable, that is, the relative order of equivalent elements is preserved.

Throws: If comp throws.

Notes: Iterators and references are not invalidated.

Complexity: The number of comparisons is approximately N log N, where N is the list's size.

References boost::container::list< T, Allocator >::size().

template<class T , class Allocator >
void boost::container::list< T, Allocator >::splice ( const_iterator  p,
list< T, Allocator > &  x 
)
inline

Requires: p must point to an element contained by the list.

x != *this. this' allocator and x's allocator shall compare equal

Effects: Transfers all the elements of list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

Throws: Nothing

Complexity: Constant.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

References BOOST_ASSERT, and boost::flyweights::x.

Referenced by boost::container::list< T, Allocator >::splice().

template<class T , class Allocator >
void boost::container::list< T, Allocator >::splice ( const_iterator  p,
BOOST_RV_REF(list< T, Allocator >)  x 
)
inline

Requires: p must point to an element contained by the list.

x != *this. this' allocator and x's allocator shall compare equal

Effects: Transfers all the elements of list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

Throws: Nothing

Complexity: Constant.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

References boost::container::list< T, Allocator >::splice(), and boost::flyweights::x.

template<class T , class Allocator >
void boost::container::list< T, Allocator >::splice ( const_iterator  p,
list< T, Allocator > &  x,
const_iterator  i 
)
inline

Requires: p must point to an element contained by this list.

i must point to an element contained in list x. this' allocator and x's allocator shall compare equal

Effects: Transfers the value pointed by i, from list x to this list, before the the element pointed by p. No destructors or copy constructors are called. If p == i or p == ++i, this function is a null operation.

Throws: Nothing

Complexity: Constant.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

References BOOST_ASSERT, boost::multiprecision::backends::i, and boost::flyweights::x.

template<class T , class Allocator >
void boost::container::list< T, Allocator >::splice ( const_iterator  p,
BOOST_RV_REF(list< T, Allocator >)  x,
const_iterator  i 
)
inline

Requires: p must point to an element contained by this list.

i must point to an element contained in list x. this' allocator and x's allocator shall compare equal.

Effects: Transfers the value pointed by i, from list x to this list, before the the element pointed by p. No destructors or copy constructors are called. If p == i or p == ++i, this function is a null operation.

Throws: Nothing

Complexity: Constant.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

References boost::multiprecision::backends::i, boost::container::list< T, Allocator >::splice(), and boost::flyweights::x.

template<class T , class Allocator >
void boost::container::list< T, Allocator >::splice ( const_iterator  p,
list< T, Allocator > &  x,
const_iterator  first,
const_iterator  last 
)
inline

Requires: p must point to an element contained by this list.

first and last must point to elements contained in list x. this' allocator and x's allocator shall compare equal

Effects: Transfers the range pointed by first and last from list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

Throws: Nothing

Complexity: Linear to the number of elements transferred.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

References BOOST_ASSERT, and boost::flyweights::x.

template<class T , class Allocator >
void boost::container::list< T, Allocator >::splice ( const_iterator  p,
BOOST_RV_REF(list< T, Allocator >)  x,
const_iterator  first,
const_iterator  last 
)
inline

Requires: p must point to an element contained by this list.

first and last must point to elements contained in list x. this' allocator and x's allocator shall compare equal.

Effects: Transfers the range pointed by first and last from list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

Throws: Nothing

Complexity: Linear to the number of elements transferred.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

References boost::container::list< T, Allocator >::splice(), and boost::flyweights::x.

template<class T , class Allocator >
void boost::container::list< T, Allocator >::splice ( const_iterator  p,
list< T, Allocator > &  x,
const_iterator  first,
const_iterator  last,
size_type  n 
)
inline

Requires: p must point to an element contained by this list.

first and last must point to elements contained in list x. n == std::distance(first, last). this' allocator and x's allocator shall compare equal

Effects: Transfers the range pointed by first and last from list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

Throws: Nothing

Complexity: Constant.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

Note: Non-standard extension

References BOOST_ASSERT, boost::n, and boost::flyweights::x.

template<class T , class Allocator >
void boost::container::list< T, Allocator >::splice ( const_iterator  p,
BOOST_RV_REF(list< T, Allocator >)  x,
const_iterator  first,
const_iterator  last,
size_type  n 
)
inline

Requires: p must point to an element contained by this list.

first and last must point to elements contained in list x. n == std::distance(first, last). this' allocator and x's allocator shall compare equal

Effects: Transfers the range pointed by first and last from list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

Throws: Nothing

Complexity: Constant.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

Note: Non-standard extension

References boost::container::list< T, Allocator >::splice(), and boost::flyweights::x.

template<class T , class Allocator >
void boost::container::list< T, Allocator >::swap ( list< T, Allocator > &  x)
inline

Effects: Swaps the contents of *this and x.

Throws: Nothing.

Complexity: Constant.

References boost::intrusive::swap().

template<class T , class Allocator >
void boost::container::list< T, Allocator >::unique ( )
inline

Effects: Removes adjacent duplicate elements or adjacent elements that are equal from the list.

Throws: If comparison throws.

Complexity: Linear time (size()-1 comparisons equality comparisons).

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

template<class T , class Allocator >
template<class BinaryPredicate >
void boost::container::list< T, Allocator >::unique ( BinaryPredicate  binary_pred)
inline

Effects: Removes adjacent duplicate elements or adjacent elements that satisfy some binary predicate from the list.

Throws: If pred throws.

Complexity: Linear time (size()-1 comparisons calls to pred()).

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

Friends And Related Function Documentation

template<class T , class Allocator >
friend class insertion_functor
friend
template<class T , class Allocator >
bool operator!= ( const list< T, Allocator > &  x,
const list< T, Allocator > &  y 
)
friend

Effects: Returns true if x and y are unequal

Complexity: Linear to the number of elements in the container.

template<class T , class Allocator >
bool operator< ( const list< T, Allocator > &  x,
const list< T, Allocator > &  y 
)
friend

Effects: Returns true if x is less than y

Complexity: Linear to the number of elements in the container.

template<class T , class Allocator >
bool operator<= ( const list< T, Allocator > &  x,
const list< T, Allocator > &  y 
)
friend

Effects: Returns true if x is equal or less than y

Complexity: Linear to the number of elements in the container.

template<class T , class Allocator >
bool operator== ( const list< T, Allocator > &  x,
const list< T, Allocator > &  y 
)
friend

Effects: Returns true if x and y are equal

Complexity: Linear to the number of elements in the container.

template<class T , class Allocator >
bool operator> ( const list< T, Allocator > &  x,
const list< T, Allocator > &  y 
)
friend

Effects: Returns true if x is greater than y

Complexity: Linear to the number of elements in the container.

template<class T , class Allocator >
bool operator>= ( const list< T, Allocator > &  x,
const list< T, Allocator > &  y 
)
friend

Effects: Returns true if x is equal or greater than y

Complexity: Linear to the number of elements in the container.

template<class T , class Allocator >
void swap ( list< T, Allocator > &  x,
list< T, Allocator > &  y 
)
friend

Effects: x.swap(y)

Complexity: Constant.


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