[#bsl-slist]
= xref:bsl.adoc[bsl]::slist
:relfileprefix: ../
:mrdocs:

Singly&hyphen;linked list container with constant&hyphen;time front insertion&period;

== Synopsis

Declared in `&lt;bslstp&lowbar;slist&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class &lowbar;Tp,
    class &lowbar;Alloc = xref:bsl/allocator-0df.adoc[bsl::allocator&lt;&lowbar;Tp&gt;]&gt;
class slist
    : protected xref:bsl/_Slist_base.adoc[&lowbar;Slist&lowbar;base&lt;&lowbar;Tp, &lowbar;Alloc&gt;]
----

== Protected Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:bsl/_Slist_base.adoc[&lowbar;Slist&lowbar;base&lt;&lowbar;Tp, &lowbar;Alloc&gt;]`
| Allocator&hyphen;aware base that owns the sentinel head node of an `slist`&period;
|===

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:bsl/slist/_Iterator_category.adoc[`&lowbar;Iterator&lowbar;category`] 
| Iterator category tag identifying a forward iterator&period;
| xref:bsl/slist/allocator_type.adoc[`allocator&lowbar;type`] 
| Allocator type used by this list&period;
| xref:bsl/slist/const_iterator.adoc[`const&lowbar;iterator`] 
| Iterator providing non&hyphen;modifiable access to elements&period;
| xref:bsl/slist/const_pointer.adoc[`const&lowbar;pointer`] 
| Pointer to a non&hyphen;modifiable element&period;
| xref:bsl/slist/const_reference.adoc[`const&lowbar;reference`] 
| Reference to a non&hyphen;modifiable element&period;
| xref:bsl/slist/difference_type.adoc[`difference&lowbar;type`] 
| Signed integral type used for iterator distances&period;
| xref:bsl/slist/iterator.adoc[`iterator`] 
| Iterator providing modifiable access to elements&period;
| xref:bsl/slist/pointer.adoc[`pointer`] 
| Pointer to a modifiable element&period;
| xref:bsl/slist/reference.adoc[`reference`] 
| Reference to a modifiable element&period;
| xref:bsl/slist/size_type.adoc[`size&lowbar;type`] 
| Unsigned integral type used for sizes&period;
| xref:bsl/slist/value_type.adoc[`value&lowbar;type`] 
| Element type stored in the list&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/slist/2constructor-07.adoc[`slist`]         [.small]#[constructor]#
| Constructors
| xref:bsl/slist/2destructor.adoc[`&#126;slist`] [.small]#[destructor]#
| Destroy this list and its elements&period;
| xref:bsl/slist/operator_assign.adoc[`operator&equals;`] 
| Assign this list to be a copy of the specified list&period;
| xref:bsl/slist/_M_assign_dispatch-0f.adoc[`&lowbar;M&lowbar;assign&lowbar;dispatch`] 
| `&lowbar;M&lowbar;assign&lowbar;dispatch` overloads
| xref:bsl/slist/_M_fill_assign.adoc[`&lowbar;M&lowbar;fill&lowbar;assign`] 
| Assign `&lowbar;&lowbar;n` copies of `&lowbar;&lowbar;val` to this list&period;
| xref:bsl/slist/assign-05.adoc[`assign`] 
| `assign` overloads
| xref:bsl/slist/before_begin-0e.adoc[`before&lowbar;begin`] 
| `before&lowbar;begin` overloads
| xref:bsl/slist/begin-02.adoc[`begin`] 
| `begin` overloads
| xref:bsl/slist/clear.adoc[`clear`] 
| Remove all elements from this list&period;
| xref:bsl/slist/empty.adoc[`empty`] 
| Return `true` if this list contains no elements&period;
| 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&lowbar;after`] 
| `erase&lowbar;after` overloads
| xref:bsl/slist/front-0d.adoc[`front`] 
| `front` overloads
| xref:bsl/slist/get_allocator.adoc[`get&lowbar;allocator`] 
| Return the allocator used by this list&period;
| xref:bsl/slist/insert-0c.adoc[`insert`] 
| `insert` overloads
| xref:bsl/slist/insert_after-0c.adoc[`insert&lowbar;after`] 
| `insert&lowbar;after` overloads
| xref:bsl/slist/max_size.adoc[`max&lowbar;size`] 
| Return an upper bound on the number of elements this list can hold&period;
| xref:bsl/slist/merge-0e.adoc[`merge`] 
| `merge` overloads
| xref:bsl/slist/pop_front.adoc[`pop&lowbar;front`] 
| Remove the first element from this list&period;
| xref:bsl/slist/previous-0e.adoc[`previous`] 
| `previous` overloads
| xref:bsl/slist/push_front.adoc[`push&lowbar;front`] 
| Insert `&lowbar;&lowbar;x` at the front of this list&period;
| xref:bsl/slist/remove.adoc[`remove`] 
| Erase all elements equal to `&lowbar;&lowbar;val`&period;
| xref:bsl/slist/remove_if.adoc[`remove&lowbar;if`] 
| Erase every element for which `&lowbar;&lowbar;pred` returns `true`&period;
| xref:bsl/slist/resize.adoc[`resize`] 
| Resize this list to `new&lowbar;size`, appending copies of `&lowbar;&lowbar;x` if growing&period;
| xref:bsl/slist/reverse.adoc[`reverse`] 
| Reverse the order of elements in this list&period;
| xref:bsl/slist/size.adoc[`size`] 
| Return the number of elements in this list&period;
| 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&lowbar;after`] 
| `splice&lowbar;after` overloads
| xref:bsl/slist/swap.adoc[`swap`] 
| Exchange the contents of this list with those of the specified list&period;
| 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[`&lowbar;M&lowbar;node&lowbar;allocator&lowbar;type`] 
| Allocator type used to allocate `&lowbar;Node` objects&period;
| xref:bsl/_Slist_base/_Node.adoc[`&lowbar;Node`] 
| Node type storing an element of type `&lowbar;Tp`&period;
| xref:bsl/_Slist_base/allocator_type.adoc[`allocator&lowbar;type`] 
| Allocator type for element values&period;
|===


== Protected Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/_Slist_base/_M_erase_after-08.adoc[`&lowbar;M&lowbar;erase&lowbar;after`] 
| `&lowbar;M&lowbar;erase&lowbar;after` overloads
| xref:bsl/_Slist_base/get_allocator.adoc[`get&lowbar;allocator`] 
| Return the allocator used by this base&period;
|===


== Protected Data Members

[cols="1,4"]
|===
| Name| Description
| xref:bsl/_Slist_base/_M_head.adoc[`&lowbar;M&lowbar;head`] 
| Sentinel head proxy holding the allocator and next&hyphen;pointer&period;
|===


== 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!&equals;`]
| Return `true` if the specified lists do not contain the same elements&period;
| xref:bsl/operator_lt-05.adoc[`operator&lt;`]
| Return `true` if `&lowbar;&lowbar;x` is lexicographically less than `&lowbar;&lowbar;y`&period;
| xref:bsl/operator_le-02.adoc[`operator&lt;&equals;`]
| Return whether `&lowbar;&lowbar;x` is lexicographically &lt;&equals; `&lowbar;&lowbar;y`&period;
| xref:bsl/operator_eq-0a7.adoc[`operator&equals;&equals;`]
| Return `true` if the specified lists have the same elements in order&period;
| xref:bsl/operator_gt-0f.adoc[`operator&gt;`]
| Return `true` if `&lowbar;&lowbar;x` is lexicographically greater than `&lowbar;&lowbar;y`&period;
| xref:bsl/operator_ge-08b.adoc[`operator&gt;&equals;`]
| Return `true` if `&lowbar;&lowbar;x` is lexicographically greater than or equal to `&lowbar;&lowbar;y`&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
