[#bsl-list-054-sort-08]
= xref:bsl.adoc[bsl]::xref:bsl/list-054.adoc[list]::sort
:relfileprefix: ../../
:mrdocs:

`sort` overloads

== Synopses

Declared in `&lt;bslstl&lowbar;list&period;h&gt;`

Sort this list in non&hyphen;decreasing order according to the order provided by `operator&lt;`&period; `operator&lt;` must provide a strict weak ordering over `value&lowbar;type` (see &lsqb;&rsqb;and Strict Weak Ordering))&period; The sort is stable, meaning that if `!(a &lt; b) &amp;&amp; !(b &lt; a)`, then the ordering of elements `a` and `b` in the sequence is preserved&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
xref:bsl/list-054/sort-05.adoc[sort]();
----

[.small]#xref:bsl/list-054/sort-05.adoc[_» more&period;&period;&period;_]#

Sort this list in non&hyphen;decreasing order according to the order provided by the specified `comparator` predicate&period; `comparator` must define a strict weak ordering over `value&lowbar;type` (see &lsqb;&rsqb;and Strict Weak Ordering))&period; The sort is stable, meaning that if `!comparator(a, b) &amp;&amp; !comparator(b, a)`, then the ordering of elements `a` and `b` in the sequence is preserved&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class COMPARE&gt;
void
xref:bsl/list-054/sort-0a.adoc[sort](COMPARE comparator);
----

[.small]#xref:bsl/list-054/sort-0a.adoc[_» more&period;&period;&period;_]#


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