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

Sort this list in non&hyphen;decreasing order using the specified `comparator`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class COMPARE&gt;
void
sort(COMPARE comparator);
----

== Description

`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;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *comparator*
| binary predicate defining the sort order
|===


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