[#bsl-slist] = xref:bsl.adoc[bsl]::slist :relfileprefix: ../ :mrdocs: Singly‐linked list container with constant‐time front insertion. == Synopsis Declared in `<bslstp_slist.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class _Tp, class _Alloc = xref:bsl/allocator-0df.adoc[bsl::allocator<_Tp>]> class slist : protected xref:bsl/_Slist_base.adoc[_Slist_base<_Tp, _Alloc>] ---- == Protected Base Classes [cols="1,4"] |=== | Name| Description | `xref:bsl/_Slist_base.adoc[_Slist_base<_Tp, _Alloc>]` | Allocator‐aware base that owns the sentinel head node of an `slist`. |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:bsl/slist/_Iterator_category.adoc[`_Iterator_category`] | Iterator category tag identifying a forward iterator. | xref:bsl/slist/allocator_type.adoc[`allocator_type`] | Allocator type used by this list. | xref:bsl/slist/const_iterator.adoc[`const_iterator`] | Iterator providing non‐modifiable access to elements. | xref:bsl/slist/const_pointer.adoc[`const_pointer`] | Pointer to a non‐modifiable element. | xref:bsl/slist/const_reference.adoc[`const_reference`] | Reference to a non‐modifiable element. | xref:bsl/slist/difference_type.adoc[`difference_type`] | Signed integral type used for iterator distances. | xref:bsl/slist/iterator.adoc[`iterator`] | Iterator providing modifiable access to elements. | xref:bsl/slist/pointer.adoc[`pointer`] | Pointer to a modifiable element. | xref:bsl/slist/reference.adoc[`reference`] | Reference to a modifiable element. | xref:bsl/slist/size_type.adoc[`size_type`] | Unsigned integral type used for sizes. | xref:bsl/slist/value_type.adoc[`value_type`] | Element type stored in the list. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/slist/2constructor-07.adoc[`slist`] [.small]#[constructor]# | Constructors | xref:bsl/slist/2destructor.adoc[`~slist`] [.small]#[destructor]# | Destroy this list and its elements. | xref:bsl/slist/operator_assign.adoc[`operator=`] | Assign this list to be a copy of the specified list. | xref:bsl/slist/_M_assign_dispatch-0f.adoc[`_M_assign_dispatch`] | `_M_assign_dispatch` overloads | xref:bsl/slist/_M_fill_assign.adoc[`_M_fill_assign`] | Assign `__n` copies of `__val` to this list. | xref:bsl/slist/assign-05.adoc[`assign`] | `assign` overloads | xref:bsl/slist/before_begin-0e.adoc[`before_begin`] | `before_begin` overloads | xref:bsl/slist/begin-02.adoc[`begin`] | `begin` overloads | xref:bsl/slist/clear.adoc[`clear`] | Remove all elements from this list. | xref:bsl/slist/empty.adoc[`empty`] | Return `true` if this list contains no elements. | xref:bsl/slist/end-0c.adoc[`end`] | `end` overloads | xref:bsl/slist/erase-07.adoc[`erase`] | `erase` overloads | xref:bsl/slist/erase_after-00.adoc[`erase_after`] | `erase_after` overloads | xref:bsl/slist/front-0d.adoc[`front`] | `front` overloads | xref:bsl/slist/get_allocator.adoc[`get_allocator`] | Return the allocator used by this list. | xref:bsl/slist/insert-0c.adoc[`insert`] | `insert` overloads | xref:bsl/slist/insert_after-0c.adoc[`insert_after`] | `insert_after` overloads | xref:bsl/slist/max_size.adoc[`max_size`] | Return an upper bound on the number of elements this list can hold. | xref:bsl/slist/merge-0e.adoc[`merge`] | `merge` overloads | xref:bsl/slist/pop_front.adoc[`pop_front`] | Remove the first element from this list. | xref:bsl/slist/previous-0e.adoc[`previous`] | `previous` overloads | xref:bsl/slist/push_front.adoc[`push_front`] | Insert `__x` at the front of this list. | xref:bsl/slist/remove.adoc[`remove`] | Erase all elements equal to `__val`. | xref:bsl/slist/remove_if.adoc[`remove_if`] | Erase every element for which `__pred` returns `true`. | xref:bsl/slist/resize.adoc[`resize`] | Resize this list to `new_size`, appending copies of `__x` if growing. | xref:bsl/slist/reverse.adoc[`reverse`] | Reverse the order of elements in this list. | xref:bsl/slist/size.adoc[`size`] | Return the number of elements in this list. | xref:bsl/slist/sort-0a1.adoc[`sort`] | `sort` overloads | xref:bsl/slist/splice-01.adoc[`splice`] | `splice` overloads | xref:bsl/slist/splice_after-027.adoc[`splice_after`] | `splice_after` overloads | xref:bsl/slist/swap.adoc[`swap`] | Exchange the contents of this list with those of the specified list. | xref:bsl/slist/unique-0d.adoc[`unique`] | `unique` overloads |=== == Protected Type Aliases [cols="1,4"] |=== | Name| Description | xref:bsl/_Slist_base/_M_node_allocator_type.adoc[`_M_node_allocator_type`] | Allocator type used to allocate `_Node` objects. | xref:bsl/_Slist_base/_Node.adoc[`_Node`] | Node type storing an element of type `_Tp`. | xref:bsl/_Slist_base/allocator_type.adoc[`allocator_type`] | Allocator type for element values. |=== == Protected Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/_Slist_base/_M_erase_after-08.adoc[`_M_erase_after`] | `_M_erase_after` overloads | xref:bsl/_Slist_base/get_allocator.adoc[`get_allocator`] | Return the allocator used by this base. |=== == Protected Data Members [cols="1,4"] |=== | Name| Description | xref:bsl/_Slist_base/_M_head.adoc[`_M_head`] | Sentinel head proxy holding the allocator and next‐pointer. |=== == Friends [cols="1,4"] |=== | Name| Description | `bsl::slist::QuickSwap` | |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/operator_not_eq-04.adoc[`operator!=`] | Return `true` if the specified lists do not contain the same elements. | xref:bsl/operator_lt-05.adoc[`operator<`] | Return `true` if `__x` is lexicographically less than `__y`. | xref:bsl/operator_le-02.adoc[`operator<=`] | Return `true` if `__x` is lexicographically less than or equal to `__y`. | xref:bsl/operator_eq-0a7.adoc[`operator==`] | Return `true` if the specified lists have the same elements in order. | xref:bsl/operator_gt-0f.adoc[`operator>`] | Return `true` if `__x` is lexicographically greater than `__y`. | xref:bsl/operator_ge-08b.adoc[`operator>=`] | Return `true` if `__x` is lexicographically greater than or equal to `__y`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#