Singly‐linked list container with constant‐time front insertion.

Synopsis

Declared in <bslstp_slist.h>

template<
    class _Tp,
    class _Alloc = bsl::allocator<_Tp>>
class slist
    : protected _Slist_base<_Tp, _Alloc>

Protected Base Classes

Name

Description

_Slist_base<_Tp, _Alloc>

Allocator‐aware base that owns the sentinel head node of an slist.

Type Aliases

Name

Description

_Iterator_category

Iterator category tag identifying a forward iterator.

allocator_type

Allocator type used by this list.

const_iterator

Iterator providing non‐modifiable access to elements.

const_pointer

Pointer to a non‐modifiable element.

const_reference

Reference to a non‐modifiable element.

difference_type

Signed integral type used for iterator distances.

iterator

Iterator providing modifiable access to elements.

pointer

Pointer to a modifiable element.

reference

Reference to a modifiable element.

size_type

Unsigned integral type used for sizes.

value_type

Element type stored in the list.

Member Functions

Name

Description

slist [constructor]

Constructors

~slist [destructor]

Destroy this list and its elements.

operator=

Assign this list to be a copy of the specified list.

_M_assign_dispatch

_M_assign_dispatch overloads

_M_fill_assign

Assign __n copies of __val to this list.

assign

assign overloads

before_begin

before_begin overloads

begin

begin overloads

clear

Remove all elements from this list.

empty

Return true if this list contains no elements.

end

end overloads

erase

erase overloads

erase_after

erase_after overloads

front

front overloads

get_allocator

Return the allocator used by this list.

insert

insert overloads

insert_after

insert_after overloads

max_size

Return an upper bound on the number of elements this list can hold.

merge

merge overloads

pop_front

Remove the first element from this list.

previous

previous overloads

push_front

Insert __x at the front of this list.

remove

Erase all elements equal to __val.

remove_if

Erase every element for which __pred returns true.

resize

Resize this list to new_size, appending copies of __x if growing.

reverse

Reverse the order of elements in this list.

size

Return the number of elements in this list.

sort

sort overloads

splice

splice overloads

splice_after

splice_after overloads

swap

Exchange the contents of this list with those of the specified list.

unique

unique overloads

Protected Type Aliases

Name

Description

_M_node_allocator_type

Allocator type used to allocate _Node objects.

_Node

Node type storing an element of type _Tp.

allocator_type

Allocator type for element values.

Protected Member Functions

Name

Description

_M_erase_after

_M_erase_after overloads

get_allocator

Return the allocator used by this base.

Protected Data Members

Name

Description

_M_head

Sentinel head proxy holding the allocator and next‐pointer.

Friends

Name

Description

bsl::slist::QuickSwap

Non-Member Functions

Name

Description

operator!=

Return true if the specified lists do not contain the same elements.

operator<

Return true if __x is lexicographically less than __y.

operator<=

Return true if __x is lexicographically less than or equal to __y.

operator==

Return true if the specified lists have the same elements in order.

operator>

Return true if __x is lexicographically greater than __y.

operator>=

Return true if __x is lexicographically greater than or equal to __y.

Created with MrDocs