Forward declaration required by List_NodeProctor.

Synopsis

Declared in <bslstl_list.h>

template<
    class LIST_VALUE,
    class LIST_ALLOCATOR = bsl::allocator<VALUE>>
class list;

Type Aliases

Name

Description

allocator_type

Allocator type used by this list.

const_iterator

Iterator providing non‐modifiable access to elements in this list.

const_pointer

Pointer to a non‐modifiable element in this list.

const_reference

Reference to a non‐modifiable element stored in this list.

const_reverse_iterator

Reverse iterator over non‐modifiable list elements.

difference_type

Signed integral type used to express distances between iterators.

iterator

Iterator providing modifiable access to elements in this list.

pointer

Pointer to a modifiable element in this list.

reference

Reference to an element stored in this list.

reverse_iterator

Reverse iterator over modifiable list elements.

size_type

Unsigned integral type large enough to hold any valid element count.

value_type

Type of the elements stored in this list.

Member Functions

Name

Description

list [constructor]

Constructors

~list [destructor]

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

operator=

Assignment operators

append_range

Append to the end of this object the elements of the specified range. Note that range must meet the requirements of an input range and the values from range must have a type matching or convertible to (template parameter) VALUE.

assign

assign overloads

assign_range

Assign to this object the elements of the specified range. Note that range must meet the requirements of an input range and the values from range must have a type matching or convertible to (template parameter) VALUE.

back

back overloads

begin

begin overloads

cbegin

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

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

clear

Remove all the elements from this list.

crbegin

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

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

emplace

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_back

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_front

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

empty

Return true if this list has no elements, and false otherwise.

end

end overloads

erase

erase overloads

front

front overloads

get_allocator

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

insert

insert overloads

insert_range

Insert at the specified position in this object the elements of the specified range. Note that range must meet the requirements of an input range and the values from range must have a type matching or convertible to (template parameter) VALUE.

max_size

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

merge overloads

pop_back

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

pop_front

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

prepend_range

Prepend to the front of this object the elements of the specified range. Note that range must meet the requirements of an input range and the values from range must have a type matching or convertible to (template parameter) VALUE.

push_back

push_back overloads

push_front

push_front overloads

rbegin

rbegin overloads

remove

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

remove_if

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

rend

rend overloads

resize

resize overloads

reverse

Reverse the order of the elements in this list.

size

Return the number of elements in this list.

sort

sort overloads

splice

splice overloads

swap

Exchange the value of this object with that of the specified other object; also exchange the allocator of this object with that of other if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This method provides the no‐throw exception‐safety guarantee. This operation has O[1] complexity if either this object was created with the same allocator as other or ALLOCATOR has the propagate_on_container_swap trait; otherwise, it has O[n + m] complexity, where n and m are the number of elements in this object and other, respectively. Note that this method`s support for swapping objects created with different allocators when ALLOCATOR does not have the propagate_on_container_swap trait is a departure from the C++ Standard.

unique

unique overloads

Deduction Guides

Name

Description

list<VALUE>

Deduce the template parameter VALUE from the value_type of the iterators supplied to the constructor of list.

list<VALUE>

Deduce the template parameter VALUE from the value_type of the intializer_list supplied to the constructor of list. This deduction guide does not participate unless the specified ALLOC is convertible to bsl::allocator<CHAR_TYPE>.

list<VALUE>

Deduce the template parameter VALUE from the value_type of the iterators supplied to the constructor of list. This deduction guide does not participate unless the specified ALLOC is convertible to bsl::allocator<CHAR_TYPE>.

list<VALUE>

Deduce the template parameter VALUE from the corresponding parameter supplied to the constructor of list. This deduction guide does not participate unless the supplied allocator is convertible to bsl::allocator<VALUE>.

list<VALUE, ALLOCATOR>

Deduce the template parameter VALUE from the value_type of the iterators supplied to the constructor of list. Deduce the template parameter ALLOCATOR from the allocator supplied to the constructor of list. This deduction guide does not participate unless the supplied allocator meets the requirements of a standard allocator.

list<ranges::range_value_t<t_RANGE>, t_ALLOCATOR>

Deduce the template parameters VALUE_TYPE and ALLOCATOR from the parameters supplied to the constructor of list.

Friends

Name

Description

bsl::List_NodeProctor

This class provides a proctor to free a node containing an uninitialized VALUE object in the event that an exception is thrown.

Non-Member Functions

Name

Description

erase

Erase all the elements in the specified list l that compare equal to the specified value. Return the number of elements erased.

erase_if

Erase all the elements in the specified list l that satisfy the specified predicate predicate. Return the number of elements erased.

operator<=>

Perform a lexicographic three‐way comparison of the specified lhs and the specified rhs lists by using the comparison operators of VALUE on each element; return the result of that comparison.

operator==

Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two list objects lhs and rhs have the same value if they have the same number of elements, and each element in the ordered sequence of elements of lhs has the same value as the corresponding element in the ordered sequence of elements of rhs. This method requires that the (template parameter) type VALUE be equality‐comparable (see {Requirements on VALUE}).

swap

Exchange the value of the specified a object with that of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no‐throw exception‐safety guarantee. This operation has O[1] complexity if either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait; otherwise, it has O[n + m] complexity, where n and m are the number of elements in a and b, respectively. Note that this function`s support for swapping objects created with different allocators when ALLOCATOR does not have the propagate_on_container_swap trait is a departure from the C++ Standard.

Created with MrDocs