Sort
You can sort a range with std::sort
or std::stable_sort
or sort until a position with std::partial_sort
. In addition std::partial_sort_copy
copies the partially sorted range. With std::nth_element
you can assign an element the sorted position in the range. You can check with std::is_sorted
if a range is sorted. If you want to know until which position a range is sorted, use std::is_sorted_until
.
Per default the predefined function object std::less
is used a as sorting criterion. However, you can use your sorting criterion. This has to obey the strict weak ordering.
Sorts the elements in the range:
Sorts the elements in the range (stable):