BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsl::list< VALUE, ALLOCATOR > Class Template Reference

#include <bslstl_list.h>

Public Types

typedef VALUE & reference
 
typedef const VALUE & const_reference
 
typedef List_Iterator< VALUE > iterator
 
typedef List_Iterator< const VALUE > const_iterator
 
typedef allocator_traits< ALLOCATOR >::pointer pointer
 
typedef allocator_traits< ALLOCATOR >::const_pointer const_pointer
 
typedef allocator_traits< ALLOCATOR >::size_type size_type
 
typedef allocator_traits< ALLOCATOR >::difference_type difference_type
 
typedef VALUE value_type
 
typedef ALLOCATOR allocator_type
 
typedef bsl::reverse_iterator< iteratorreverse_iterator
 
typedef bsl::reverse_iterator< const_iteratorconst_reverse_iterator
 

Public Member Functions

 list ()
 
 list (const ALLOCATOR &basicAllocator)
 
 list (size_type numElements)
 
 list (size_type numElements, const ALLOCATOR &basicAllocator)
 
 list (size_type numElements, const value_type &value, const ALLOCATOR &basicAllocator=ALLOCATOR())
 
template<class INPUT_ITERATOR >
 list (INPUT_ITERATOR first, INPUT_ITERATOR last, const ALLOCATOR &basicAllocator=ALLOCATOR(), typename enable_if< !is_arithmetic< INPUT_ITERATOR >::value &&!is_enum< INPUT_ITERATOR >::value >::type *=0)
 
 list (const list &original)
 
 list (const list &original, const typename type_identity< ALLOCATOR >::type &basicAllocator)
 
 list (BloombergLP::bslmf::MovableRef< list > original)
 
 list (BloombergLP::bslmf::MovableRef< list > original, const typename type_identity< ALLOCATOR >::type &basicAllocator)
 
 ~list ()
 
listoperator= (const list &rhs)
 
template<class INPUT_ITERATOR >
list &operator=(BloombergLP::bslmf::MovableRef< list > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocTraits void assign (INPUT_ITERATOR first, INPUT_ITERATOR last, typename enable_if< !is_arithmetic< INPUT_ITERATOR >::value &&!is_enum< INPUT_ITERATOR >::value >::type *=0)
 
void assign (size_type numElements, const value_type &value)
 
iterator begin () BSLS_KEYWORD_NOEXCEPT
 
iterator end () BSLS_KEYWORD_NOEXCEPT
 
reverse_iterator rbegin () BSLS_KEYWORD_NOEXCEPT
 
reverse_iterator rend () BSLS_KEYWORD_NOEXCEPT
 
void clear () BSLS_KEYWORD_NOEXCEPT
 Remove all the elements from this list.
 
void resize (size_type newSize)
 
void resize (size_type newSize, const value_type &value)
 
reference back ()
 
reference front ()
 
void pop_back ()
 
void pop_front ()
 
iterator erase (const_iterator position)
 
iterator erase (const_iterator dstBegin, const_iterator dstEnd)
 
template<class... ARGS>
reference emplace_back (ARGS &&... arguments)
 
template<class... ARGS>
reference emplace_front (ARGS &&... arguments)
 
void push_back (const value_type &value)
 
void push_back (BloombergLP::bslmf::MovableRef< value_type > value)
 
void push_front (const value_type &value)
 
void push_front (BloombergLP::bslmf::MovableRef< value_type > value)
 
template<class... ARGS>
iterator emplace (const_iterator position, ARGS &&... arguments)
 
iterator insert (const_iterator dstPosition, const value_type &value)
 
iterator insert (const_iterator dstPosition, BloombergLP::bslmf::MovableRef< value_type > value)
 
iterator insert (const_iterator dstPosition, size_type numElements, const value_type &value)
 
template<class INPUT_ITERATOR >
iterator insert (const_iterator dstPosition, INPUT_ITERATOR first, INPUT_ITERATOR last, typename enable_if< !is_arithmetic< INPUT_ITERATOR >::value &&!is_enum< INPUT_ITERATOR >::value >::type *=0)
 
void merge (list &other)
 
void merge (BloombergLP::bslmf::MovableRef< list > other)
 
template<class COMPARE >
void merge (list &other, COMPARE comparator)
 
template<class COMPARE >
void merge (BloombergLP::bslmf::MovableRef< list > other, COMPARE comparator)
 
size_type remove (const value_type &value)
 
template<class PREDICATE >
size_type remove_if (PREDICATE predicate)
 
void reverse () BSLS_KEYWORD_NOEXCEPT
 Reverse the order of the elements in this list.
 
void sort ()
 
template<class COMPARE >
void sort (COMPARE comparator)
 
void splice (const_iterator dstPosition, list &src)
 
void splice (const_iterator dstPosition, BloombergLP::bslmf::MovableRef< list > src)
 
void splice (const_iterator dstPosition, list &src, const_iterator srcNode)
 
void splice (const_iterator dstPosition, BloombergLP::bslmf::MovableRef< list > src, const_iterator srcNode)
 
void splice (const_iterator dstPosition, list &src, const_iterator first, const_iterator last)
 
void splice (const_iterator dstPosition, BloombergLP::bslmf::MovableRef< list > src, const_iterator first, const_iterator last)
 
void unique ()
 
template<class EQ_PREDICATE >
void unique (EQ_PREDICATE binaryPredicate)
 
const_iterator cbegin () const BSLS_KEYWORD_NOEXCEPT
 
const_iterator end () const BSLS_KEYWORD_NOEXCEPT
 
const_iterator cend () const BSLS_KEYWORD_NOEXCEPT
 
const_reverse_iterator rbegin () const BSLS_KEYWORD_NOEXCEPT
 
const_reverse_iterator crbegin () const BSLS_KEYWORD_NOEXCEPT
 
const_reverse_iterator rend () const BSLS_KEYWORD_NOEXCEPT
 
const_reverse_iterator crend () const BSLS_KEYWORD_NOEXCEPT
 
bool empty () const BSLS_KEYWORD_NOEXCEPT
 Return true if this list has no elements, and false otherwise.
 
size_type max_size () const BSLS_KEYWORD_NOEXCEPT
 
size_type size () const BSLS_KEYWORD_NOEXCEPT
 Return the number of elements in this list.
 
const_reference back () const
 
const_reference front () const
 
allocator_type get_allocator () const BSLS_KEYWORD_NOEXCEPT
 
template<class COMPARE >
list< VALUE, ALLOCATOR >::NodePtr mergeImp (NodePtr node1, NodePtr node2, NodePtr finish, COMPARE comparator)
 
template<class COMPARE >
list< VALUE, ALLOCATOR >::NodePtr sortImp (NodePtr *nodePtrPtr, size_type size, const COMPARE &comparator)
 
template<class... ARGS>
list< VALUE, ALLOCATOR >::reference emplace_back (ARGS &&... arguments)
 
template<class... ARGS>
list< VALUE, ALLOCATOR >::reference emplace_front (ARGS &&... arguments)
 
template<class... ARGS>
list< VALUE, ALLOCATOR >::iterator emplace (const_iterator position, ARGS &&... arguments)
 
template<class PREDICATE >
list< VALUE, ALLOCATOR >::size_type remove_if (PREDICATE predicate)
 

Public Attributes

void swap(list &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocTraits const_iterator begin () const BSLS_KEYWORD_NOEXCEPT
 

Friends

class List_NodeProctor< VALUE, ALLOCATOR >
 

Detailed Description

template<class VALUE, class ALLOCATOR = bsl::allocator<VALUE>>
class bsl::list< VALUE, ALLOCATOR >

This class template implements a value-semantic container type holding a sequence of elements of the (template parameter) VALUE type.

See bslstl_list

Member Typedef Documentation

◆ allocator_type

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
typedef ALLOCATOR bsl::list< VALUE, ALLOCATOR >::allocator_type

◆ const_iterator

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
typedef List_Iterator<const VALUE> bsl::list< VALUE, ALLOCATOR >::const_iterator

◆ const_pointer

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
typedef allocator_traits<ALLOCATOR>::const_pointer bsl::list< VALUE, ALLOCATOR >::const_pointer

◆ const_reference

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
typedef const VALUE& bsl::list< VALUE, ALLOCATOR >::const_reference

◆ const_reverse_iterator

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
typedef bsl::reverse_iterator<const_iterator> bsl::list< VALUE, ALLOCATOR >::const_reverse_iterator

◆ difference_type

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
typedef allocator_traits<ALLOCATOR>::difference_type bsl::list< VALUE, ALLOCATOR >::difference_type

◆ iterator

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
typedef List_Iterator<VALUE> bsl::list< VALUE, ALLOCATOR >::iterator

◆ pointer

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
typedef allocator_traits<ALLOCATOR>::pointer bsl::list< VALUE, ALLOCATOR >::pointer

◆ reference

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
typedef VALUE& bsl::list< VALUE, ALLOCATOR >::reference

◆ reverse_iterator

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
typedef bsl::reverse_iterator<iterator> bsl::list< VALUE, ALLOCATOR >::reverse_iterator

◆ size_type

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
typedef allocator_traits<ALLOCATOR>::size_type bsl::list< VALUE, ALLOCATOR >::size_type

◆ value_type

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
typedef VALUE bsl::list< VALUE, ALLOCATOR >::value_type

Constructor & Destructor Documentation

◆ list() [1/10]

template<class VALUE , class ALLOCATOR >
bsl::list< VALUE, ALLOCATOR >::list ( )

Create an empty list. A default-constructed object of the (template parameter) type ALLOCATOR is used. If the type ALLOCATOR is bsl::allocator, the currently installed default allocator is used.

◆ list() [2/10]

template<class VALUE , class ALLOCATOR >
bsl::list< VALUE, ALLOCATOR >::list ( const ALLOCATOR &  basicAllocator)
explicit

Create an empty list. Use the specified basicAllocator to supply memory. If the type ALLOCATOR is bsl::allocator (the default), then basicAllocator shall be convertible to bslma::Allocator *.

◆ list() [3/10]

template<class VALUE , class ALLOCATOR >
bsl::list< VALUE, ALLOCATOR >::list ( size_type  numElements)
explicit

Create a list of the specified numElements size whose every element is default-constructed. A default-constructed object of the (template parameter) type ALLOCATOR is used. If the type ALLOCATOR is bsl::allocator, the currently installed default allocator is used. Throw bsl::length_error if numElements > max_size(). This method requires that the (template parameter) VALUE be default-insertable into this list (see {Requirements on VALUE}).

◆ list() [4/10]

template<class VALUE , class ALLOCATOR >
bsl::list< VALUE, ALLOCATOR >::list ( size_type  numElements,
const ALLOCATOR &  basicAllocator 
)

Create a list of the specified numElements size whose every element is default-constructed. Use the specified basicAllocator to supply memory. If the type ALLOCATOR is bsl::allocator (the default), then basicAllocator shall be convertible to bslma::Allocator *. Throw bsl::length_error if numElements > max_size(). This method requires that the (template parameter) VALUE be default-insertable into this list (see {Requirements on VALUE}).

◆ list() [5/10]

template<class VALUE , class ALLOCATOR >
bsl::list< VALUE, ALLOCATOR >::list ( size_type  numElements,
const value_type value,
const ALLOCATOR &  basicAllocator = ALLOCATOR() 
)

Create a list of the specified numElements size whose every element has the specified value. Optionally specify a basicAllocator used to supply memory. If basicAllocator is not supplied, a default-constructed object of the (template parameter) type ALLOCATOR is used. If the type ALLOCATOR is bsl::allocator (the default), then basicAllocator, if supplied, shall be convertible to bslma::Allocator *. If the type ALLOCATOR is bsl::allocator and basicAllocator is not supplied, the currently installed default allocator is used. Throw bsl::length_error if numElements > max_size(). This method requires that the (template parameter) VALUE be copy-insertable into this list (see {Requirements on VALUE}).

◆ list() [6/10]

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class INPUT_ITERATOR >
bsl::list< VALUE, ALLOCATOR >::list ( INPUT_ITERATOR  first,
INPUT_ITERATOR  last,
const ALLOCATOR &  basicAllocator = ALLOCATOR(),
typename enable_if< !is_arithmetic< INPUT_ITERATOR >::value &&!is_enum< INPUT_ITERATOR >::value >::type *  = 0 
)
inline

Create a list initially containing copies of the values in the range starting at the specified first and ending immediately before the specified last iterators of the (template parameter) type INPUT_ITERATOR. Optionally specify a basicAllocator used to supply memory. If basicAllocator is not supplied, a default-constructed object of the (template parameter) type ALLOCATOR is used. If the type ALLOCATOR is bsl::allocator (the default), then basicAllocator, if supplied, shall be convertible to bslma::Allocator *. If the type ALLOCATOR is bsl::allocator and basicAllocator is not supplied, the currently installed default allocator is used. Throw bsl::length_error if the number of elements in [first .. last) exceeds the size returned by max_size . The (template parameter) type INPUT_ITERATOR shall meet the requirements of an input iterator defined in the C++11 standard [input.iterators] providing access to values of a type convertible to value_type, and value_type must be emplace-constructible from *i into this list, where i is a dereferenceable iterator in the range [first .. last) (see {Requirements on VALUE}). The behavior is undefined unless first and last refer to a sequence of valid values where first is at a position at or before last.

◆ list() [7/10]

template<class VALUE , class ALLOCATOR >
bsl::list< VALUE, ALLOCATOR >::list ( const list< VALUE, ALLOCATOR > &  original)

Create a list having the same value as the specified original object. Use the allocator returned by 'bsl::allocator_traits<ALLOCATOR>:: select_on_container_copy_construction(original.get_allocator())' to allocate memory. This method requires that the (template parameter) type VALUE be copy-insertable into this list (see {Requirements on VALUE}).

◆ list() [8/10]

template<class VALUE , class ALLOCATOR >
bsl::list< VALUE, ALLOCATOR >::list ( const list< VALUE, ALLOCATOR > &  original,
const typename type_identity< ALLOCATOR >::type &  basicAllocator 
)

Create a list that has the same value as the specified original object. Use the specified basicAllocator to supply memory. This method requires that the (template parameter) VALUE be copy-insertable into this list (see {Requirements on VALUE}). Note that a bslma::Allocator * can be supplied for basicAllocator if the (template parameter) type ALLOCATOR is bsl::allocator (the default).

◆ list() [9/10]

template<class VALUE , class ALLOCATOR >
bsl::list< VALUE, ALLOCATOR >::list ( BloombergLP::bslmf::MovableRef< list< VALUE, ALLOCATOR > >  original)

Create a list having the same value as the specified original object by moving (in constant time) the contents of original to the new list. The allocator associated with original is propagated for use in the newly-created list. original is left in a valid but unspecified state.

◆ list() [10/10]

template<class VALUE , class ALLOCATOR >
bsl::list< VALUE, ALLOCATOR >::list ( BloombergLP::bslmf::MovableRef< list< VALUE, ALLOCATOR > >  original,
const typename type_identity< ALLOCATOR >::type &  basicAllocator 
)

Create a list having the same value as the specified original object that uses the specified basicAllocator to supply memory. The contents of original are moved (in constant time) to the new list if basicAllocator == original.get_allocator(), and are move- inserted (in linear time) using basicAllocator otherwise. original is left in a valid but unspecified state. This method requires that the (template parameter) VALUE be move-insertable into this list (see {Requirements on VALUE}). Note that a bslma::Allocator * can be supplied for basicAllocator if the (template parameter) ALLOCATOR is bsl::allocator (the default).

◆ ~list()

template<class VALUE , class ALLOCATOR >
bsl::list< VALUE, ALLOCATOR >::~list ( )

Destroy this list by calling the destructor for each element and deallocating all allocated storage.

Member Function Documentation

◆ assign() [1/2]

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class INPUT_ITERATOR >
list &operator=(BloombergLP::bslmf::MovableRef< list > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocTraits void bsl::list< VALUE, ALLOCATOR >::assign ( INPUT_ITERATOR  first,
INPUT_ITERATOR  last,
typename enable_if< !is_arithmetic< INPUT_ITERATOR >::value &&!is_enum< INPUT_ITERATOR >::value >::type *  = 0 
)
inline

Assign to this list the sequence of values, in order, of the elements of the specified range [first .. last). The (template parameter) type INPUT_ITERATOR shall meet the requirements of an input iterator defined in the C++11 standard [24.2.3] providing access to values of a type convertible to value_type, and value_type must be emplace-constructible from *i into this list, where i is a dereferenceable iterator in the range [first .. last). The behavior is undefined unless first and last refer to a sequence of valid values where first is at a position at or before last. Note that, to the extent possible, existing elements of this list are copy-assigned to, to minimize the number of nodes that need to be copy-inserted or erased. If an exception is thrown, *this is left in a valid but unspecified state.

◆ assign() [2/2]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::assign ( size_type  numElements,
const value_type value 
)

Replace the contents of this list with the specified numElements copies of the specified value. Note that, to the extent possible, existing elements of this list are copy-assigned to, to minimize the number of nodes that need to be copy-inserted or erased.

◆ back() [1/2]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::reference bsl::list< VALUE, ALLOCATOR >::back ( )
inline

Return a reference providing modifiable access to the last element of this list. The behavior is undefined unless this list contains at least one element.

◆ back() [2/2]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::const_reference bsl::list< VALUE, ALLOCATOR >::back ( ) const
inline

Return a reference providing non-modifiable access to the last element of this list. The behavior is undefined unless this list contains at least one element.

◆ begin()

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
iterator bsl::list< VALUE, ALLOCATOR >::begin ( )

Return an iterator providing modifiable access to the first element in this list, and the past-the-end iterator if this list is empty.

◆ cbegin()

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::const_iterator bsl::list< VALUE, ALLOCATOR >::cbegin ( ) const
inline

Return an iterator providing non-modifiable access to the first value_type object in the ordered sequence of value_type objects maintained by this list, or the end iterator if this list is empty.

◆ cend()

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::const_iterator bsl::list< VALUE, ALLOCATOR >::cend ( ) const
inline

Return the past-the-end (forward) iterator providing non-modifiable access to this list.

◆ clear()

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::clear ( )
inline

◆ crbegin()

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::const_reverse_iterator bsl::list< VALUE, ALLOCATOR >::crbegin ( ) const
inline

Return a reverse iterator providing non-modifiable access to the last element in this list, and the past-the-end reverse iterator if this list is empty.

◆ crend()

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::const_reverse_iterator bsl::list< VALUE, ALLOCATOR >::crend ( ) const
inline

Return the past-the-end reverse iterator providing non-modifiable access to this list.

◆ emplace() [1/2]

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class... ARGS>
iterator bsl::list< VALUE, ALLOCATOR >::emplace ( const_iterator  position,
ARGS &&...  arguments 
)

Insert at the specified position in this list a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) arguments to the corresponding constructor of value_type, and return an iterator providing modifiable access to the newly created and inserted element. If an exception is thrown (other than by the copy constructor, move constructor, assignment operator, or move assignment operator of value_type), this method has no effect. This method requires that the (template parameter) VALUE be move-insertable into this list and emplace-constructible from arguments (see {Requirements on VALUE}). The behavior is undefined unless position is an iterator in the range [cbegin() .. cend()] (both endpoints included).

◆ emplace() [2/2]

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class... ARGS>
list< VALUE, ALLOCATOR >::iterator bsl::list< VALUE, ALLOCATOR >::emplace ( const_iterator  position,
ARGS &&...  arguments 
)

◆ emplace_back() [1/2]

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class... ARGS>
reference bsl::list< VALUE, ALLOCATOR >::emplace_back ( ARGS &&...  arguments)

Append to the back of this list a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) arguments to the corresponding constructor of value_type. Return a reference providing modifiable access to the inserted element. If an exception is thrown (other than by the move constructor of a non-copy-insertable value_type), this method has no effect. This method requires that the (template parameter) VALUE be move-insertable into this list and emplace-constructible from arguments (see {Requirements on VALUE}).

◆ emplace_back() [2/2]

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class... ARGS>
list< VALUE, ALLOCATOR >::reference bsl::list< VALUE, ALLOCATOR >::emplace_back ( ARGS &&...  arguments)
inline

◆ emplace_front() [1/2]

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class... ARGS>
reference bsl::list< VALUE, ALLOCATOR >::emplace_front ( ARGS &&...  arguments)

Prepend to the front of this list a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) arguments to the corresponding constructor of value_type. Return a reference providing modifiable access to the inserted element. If an exception is thrown (other than by the move constructor of a non-copy-insertable value_type), this method has no effect. This method requires that the (template parameter) VALUE be move-insertable into this list and emplace-constructible from arguments (see {Requirements on VALUE}).

◆ emplace_front() [2/2]

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class... ARGS>
list< VALUE, ALLOCATOR >::reference bsl::list< VALUE, ALLOCATOR >::emplace_front ( ARGS &&...  arguments)
inline

◆ empty()

template<class VALUE , class ALLOCATOR >
bool bsl::list< VALUE, ALLOCATOR >::empty ( ) const
inline

◆ end() [1/2]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::iterator bsl::list< VALUE, ALLOCATOR >::end ( )
inline

Return the past-the-end (forward) iterator providing modifiable access to this list.

◆ end() [2/2]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::const_iterator bsl::list< VALUE, ALLOCATOR >::end ( ) const
inline

◆ erase() [1/2]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::iterator bsl::list< VALUE, ALLOCATOR >::erase ( const_iterator  dstBegin,
const_iterator  dstEnd 
)

Remove from this list the elements starting at the specified dstBegin position up to, but not including, the specified dstEnd position, and return a non-const iterator equivalent to dstEnd. The behavior is undefined unless dstBegin is an iterator in the range [begin() .. end()] and dstEnd is an iterator in the range [dstBegin .. end()] (both endpoints included). Note that dstBegin may be equal to dstEnd, in which case the list is not modified.

◆ erase() [2/2]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::iterator bsl::list< VALUE, ALLOCATOR >::erase ( const_iterator  position)

Remove from this list the element at the specified position, and return an iterator providing modifiable access to the element immediately following the removed element, or to the position returned by the end method if the removed element was the last in the sequence. The behavior is undefined unless position refers to an element in this list.

◆ front() [1/2]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::reference bsl::list< VALUE, ALLOCATOR >::front ( )
inline

Return a reference providing modifiable access to the first element of this list. The behavior is undefined unless this list contains at least one element.

◆ front() [2/2]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::const_reference bsl::list< VALUE, ALLOCATOR >::front ( ) const
inline

Return a reference providing non-modifiable access to the first element of this list. The behavior is undefined unless this list contains at least one element.

◆ get_allocator()

template<class VALUE , class ALLOCATOR >
ALLOCATOR bsl::list< VALUE, ALLOCATOR >::get_allocator ( ) const
inline

Return a copy of the allocator used for memory allocation by this list.

◆ insert() [1/4]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::iterator bsl::list< VALUE, ALLOCATOR >::insert ( const_iterator  dstPosition,
BloombergLP::bslmf::MovableRef< value_type value 
)

Insert at the specified dstPosition in this list the specified move-insertable value, and return an iterator providing modifiable access to the newly inserted element. value is left in a valid but unspecified state. If an exception is thrown (other than by the copy constructor, move constructor, assignment operator, or move assignment operator of value_type), this method has no effect. This method requires that the (template parameter) VALUE be move-insertable into this list (see {Requirements on VALUE}). The behavior is undefined unless dstPosition is an iterator in the range [cbegin() .. cend()] (both endpoints included).

◆ insert() [2/4]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::iterator bsl::list< VALUE, ALLOCATOR >::insert ( const_iterator  dstPosition,
const value_type value 
)

Insert at the specified dstPosition in this list a copy of the specified value, and return an iterator providing modifiable access to the newly inserted element. This method offers full guarantee of rollback in case an exception is thrown other than by the VALUE copy constructor or assignment operator. This method requires that the (template parameter) VALUE be copy-insertable into this list (see {Requirements on VALUE}). The behavior is undefined unless dstPosition is an iterator in the range [cbegin() .. cend()] (both endpoints included).

◆ insert() [3/4]

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class INPUT_ITERATOR >
iterator bsl::list< VALUE, ALLOCATOR >::insert ( const_iterator  dstPosition,
INPUT_ITERATOR  first,
INPUT_ITERATOR  last,
typename enable_if< !is_arithmetic< INPUT_ITERATOR >::value &&!is_enum< INPUT_ITERATOR >::value >::type *  = 0 
)
inline

Insert at the specified dstPosition in this list the values in the range starting at the specified first and ending immediately before the specified last iterators of the (template parameter) type INPUT_ITERATOR, and return an iterator providing modifiable access to the first element in the newly inserted sequence of elements. The (template parameter) type INPUT_ITERATOR shall meet the requirements of an input iterator defined in the C++11 standard [input.iterators] providing access to values of a type convertible to value_type, and value_type must be emplace-constructible from *i into this list, where i is a dereferenceable iterator in the range [first .. last) (see {Requirements on VALUE}). The behavior is undefined unless dstPosition is an iterator in the range [cbegin() .. cend()] (both endpoints included), and first and last refer to a sequence of valid values where first is at a position at or before last.

◆ insert() [4/4]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::iterator bsl::list< VALUE, ALLOCATOR >::insert ( const_iterator  dstPosition,
size_type  numElements,
const value_type value 
)

Insert at the specified dstPosition in this list the specified numElements copies of the specified value, and return an iterator providing modifiable access to the first element in the newly inserted sequence of elements. This method requires that the (template parameter) VALUE be copy-insertable into this list (see {Requirements on VALUE}). The behavior is undefined unless dstPosition is an iterator in the range [cbegin() .. cend()] (both endpoints included).

◆ max_size()

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::size_type bsl::list< VALUE, ALLOCATOR >::max_size ( ) const
inline

Return an upper bound on the largest number of elements that this list could possibly hold. Note that the return value of this function does not guarantee that this list can successfully grow that large, or even close to that large without running out of resources.

◆ merge() [1/4]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::merge ( BloombergLP::bslmf::MovableRef< list< VALUE, ALLOCATOR > >  other)
inline

Merge the specified sorted other list into this sorted list. This method has no effect if other is this list; otherwise, other is left empty. The behavior is undefined unless both other and this list are sorted in non-decreasing order according to the ordering provided by operator<, and unless both other and this list use the same allocator. operator< must define a strict weak ordering per value_type (see {Comparators and Strict Weak Ordering}).

◆ merge() [2/4]

template<class VALUE , class ALLOCATOR >
template<class COMPARE >
void bsl::list< VALUE, ALLOCATOR >::merge ( BloombergLP::bslmf::MovableRef< list< VALUE, ALLOCATOR > >  other,
COMPARE  comparator 
)
inline

◆ merge() [3/4]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::merge ( list< VALUE, ALLOCATOR > &  other)
inline

◆ merge() [4/4]

template<class VALUE , class ALLOCATOR >
template<class COMPARE >
void bsl::list< VALUE, ALLOCATOR >::merge ( list< VALUE, ALLOCATOR > &  other,
COMPARE  comparator 
)

Merge the specified sorted other list into this sorted list, using the specified binary comparator predicate to order elements. This method has no effect if other is this list; otherwise, other is left empty. The behavior is undefined unless both other and this list are sorted in non-decreasing order according to the ordering provided by comparator, and unless both other and this list use the same allocator.

◆ mergeImp()

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class COMPARE >
list< VALUE, ALLOCATOR >::NodePtr bsl::list< VALUE, ALLOCATOR >::mergeImp ( NodePtr  node1,
NodePtr  node2,
NodePtr  finish,
COMPARE  comparator 
)

◆ operator=()

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR > & bsl::list< VALUE, ALLOCATOR >::operator= ( const list< VALUE, ALLOCATOR > &  rhs)

Assign to this object the value of the specified rhs object, propagate to this object the allocator of rhs if the ALLOCATOR type has trait propagate_on_container_copy_assignment, and return a reference providing modifiable access to this object. If an exception is thrown, *this is left in a valid but unspecified state. This method requires that the (template parameter) type VALUE be copy-assignable and copy-insertable into this list. Note that, to the extent possible, existing elements of this list are copy-assigned to, to minimize the number of nodes that need to be copy-inserted or erased.

◆ pop_back()

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::pop_back ( )
inline

Remove and destroy the last element of this list. The behavior is undefined unless this list contains at least one element.

◆ pop_front()

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::pop_front ( )
inline

Remove and destroy the first element of this list. The behavior is undefined unless this list contains at least one element.

◆ push_back() [1/2]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::push_back ( BloombergLP::bslmf::MovableRef< value_type value)
inline

Append to the back of this list the specified move-insertable value. value is left in a valid but unspecified state. If an exception is thrown (other than by the move constructor of a non-copy-insertable value_type), this method has no effect. This method requires that the (template parameter) VALUE be move-insertable into this list (see {Requirements on VALUE}).

◆ push_back() [2/2]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::push_back ( const value_type value)
inline

Append to the back of this list a copy of the specified value. This method offers full guarantee of rollback in case an exception is thrown. This method requires that the (template parameter) VALUE be copy-constructible (see {Requirements on VALUE}).

◆ push_front() [1/2]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::push_front ( BloombergLP::bslmf::MovableRef< value_type value)
inline

Prepend to the front of this list the specified move-insertable value. value is left in a valid but unspecified state. If an exception is thrown (other than by the move constructor of a non-copy-insertable value_type), this method has no effect. This method requires that the (template parameter) VALUE be move-insertable into this list (see {Requirements on VALUE}).

◆ push_front() [2/2]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::push_front ( const value_type value)
inline

Prepend to the front of this list a copy of the specified value. This method offers full guarantee of rollback in case an exception is thrown. This method requires that the (template parameter) VALUE be copy-constructible (see {Requirements on VALUE}).

◆ rbegin() [1/2]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::reverse_iterator bsl::list< VALUE, ALLOCATOR >::rbegin ( )
inline

Return a reverse iterator providing modifiable access to the last element in this list, and the past-the-end reverse iterator if this list is empty.

◆ rbegin() [2/2]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::const_reverse_iterator bsl::list< VALUE, ALLOCATOR >::rbegin ( ) const
inline

◆ remove()

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::size_type bsl::list< VALUE, ALLOCATOR >::remove ( const value_type value)

Erase all the elements having the specified value from this list and return the number of erased elements.

◆ remove_if() [1/2]

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class PREDICATE >
size_type bsl::list< VALUE, ALLOCATOR >::remove_if ( PREDICATE  predicate)

Erase all the elements in this list for which the specified unary predicate returns true and return the number of erased elements.

◆ remove_if() [2/2]

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class PREDICATE >
list< VALUE, ALLOCATOR >::size_type bsl::list< VALUE, ALLOCATOR >::remove_if ( PREDICATE  predicate)

◆ rend() [1/2]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::reverse_iterator bsl::list< VALUE, ALLOCATOR >::rend ( )
inline

Return the past-the-end reverse iterator providing modifiable access to this list.

◆ rend() [2/2]

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::const_reverse_iterator bsl::list< VALUE, ALLOCATOR >::rend ( ) const
inline

◆ resize() [1/2]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::resize ( size_type  newSize)

◆ resize() [2/2]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::resize ( size_type  newSize,
const value_type value 
)

Change the size of this list to the specified newSize. Erase size() - newSize elements at the back if newSize < size(). Append newSize - size() elements at the back having the optionally specified value if newSize > size(); if value is not specified, default-constructed objects of the (template parameter) VALUE are emplaced. This method has no effect if newSize == size(). Throw bsl::length_error if newSize > max_size().

◆ reverse()

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::reverse ( )

◆ size()

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::size_type bsl::list< VALUE, ALLOCATOR >::size ( ) const
inline

◆ sort() [1/2]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::sort ( )
inline

Sort this list in non-decreasing order according to the order provided by operator<. operator< must provide a strict weak ordering over value_type (see {Comparators and Strict Weak Ordering}). The sort is stable, meaning that if !(a < b) && !(b < a), then the ordering of elements a and b in the sequence is preserved.

◆ sort() [2/2]

template<class VALUE , class ALLOCATOR >
template<class COMPARE >
void bsl::list< VALUE, ALLOCATOR >::sort ( COMPARE  comparator)

Sort this list in non-decreasing order according to the order provided by the specified comparator predicate. comparator must define a strict weak ordering over value_type (see {Comparators and Strict Weak Ordering}). The sort is stable, meaning that if !comparator(a, b) && !comparator(b, a), then the ordering of elements a and b in the sequence is preserved.

◆ sortImp()

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
template<class COMPARE >
list< VALUE, ALLOCATOR >::NodePtr bsl::list< VALUE, ALLOCATOR >::sortImp ( NodePtr *  nodePtrPtr,
size_type  size,
const COMPARE &  comparator 
)

◆ splice() [1/6]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::splice ( const_iterator  dstPosition,
BloombergLP::bslmf::MovableRef< list< VALUE, ALLOCATOR > >  src 
)
inline

Remove all elements of the specified src list and insert them, in the same order, in this list at the specified dstPosition. The behavior is undefined unless src is not this list, this list and src use the same allocator, and dstPosition is in the range [begin() .. end()] (note both endpoints included).

◆ splice() [2/6]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::splice ( const_iterator  dstPosition,
BloombergLP::bslmf::MovableRef< list< VALUE, ALLOCATOR > >  src,
const_iterator  first,
const_iterator  last 
)
inline

Remove the elements in the specified range [first .. last) from the specified src list, and insert them, in the same order, at the specified dstPosition in this list. The behavior is undefined unless [first .. last) represents a range of valid elements in src, dstPosition is not in the range [first .. last), this list and src use the same allocator, and dstPosition is in the range [begin() .. end()] (note both endpoints included). Note that src and *this may be the same list, in which case an entire sequence of nodes is moved to a (possibly) new position in this list.

◆ splice() [3/6]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::splice ( const_iterator  dstPosition,
BloombergLP::bslmf::MovableRef< list< VALUE, ALLOCATOR > >  src,
const_iterator  srcNode 
)
inline

Remove the single element at the specified srcNode from the specified src list, and insert it at the specified dstPosition in this list. The behavior is undefined unless srcNode refers to a valid element in src, this list and src use the same allocator, and dstPosition is in the range [begin() .. end()] (note both endpoints included). Note that src and *this may be the same list, in which case the element is moved to a (possibly) new position in the list.

◆ splice() [4/6]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::splice ( const_iterator  dstPosition,
list< VALUE, ALLOCATOR > &  src 
)

◆ splice() [5/6]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::splice ( const_iterator  dstPosition,
list< VALUE, ALLOCATOR > &  src,
const_iterator  first,
const_iterator  last 
)

◆ splice() [6/6]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::splice ( const_iterator  dstPosition,
list< VALUE, ALLOCATOR > &  src,
const_iterator  srcNode 
)

◆ unique() [1/2]

template<class VALUE , class ALLOCATOR >
void bsl::list< VALUE, ALLOCATOR >::unique ( )

Erase from this list all but the first element of every consecutive group of elements that have the same value.

◆ unique() [2/2]

template<class VALUE , class ALLOCATOR >
template<class EQ_PREDICATE >
void bsl::list< VALUE, ALLOCATOR >::unique ( EQ_PREDICATE  binaryPredicate)

Erase from this list all but the first element of every consecutive group of elements for which the specified binaryPredicate returns true for any two consecutive elements in the group.

Friends And Related Symbol Documentation

◆ List_NodeProctor< VALUE, ALLOCATOR >

template<class VALUE , class ALLOCATOR = bsl::allocator<VALUE>>
friend class List_NodeProctor< VALUE, ALLOCATOR >
friend

Member Data Documentation

◆ begin

template<class VALUE , class ALLOCATOR >
list< VALUE, ALLOCATOR >::const_iterator bsl::list< VALUE, ALLOCATOR >::begin
inline

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