cpp/algorithm/stable sort

Sorts the elements in the range in non-descending order. The order of equivalent elements is guaranteed to be preserved.

A sequence is sorted with respect to a comparator if for any iterator  pointing to the sequence and any non-negative integer  such that  is a valid iterator pointing to an element of the sequence,  (or ) evaluates to.

@1@ Elements are compared using. @3@ Elements are compared using the given comparison function. @2,4@ Same as, but executed according to.

Return value
(none)

Complexity
$O(N&middot;log(N)^{2})$, where applications of. If additional memory is available, then the complexity is $O(N&middot;log(N))$.

Possible implementation
See also the implementations in libstdc++ and libc++.