sort function template — Sorts a range in place
template<typename RandIter> void sort(RandIter first, RandIter last); template<typename RandIter, typename Compare> void sort(RandIter first, RandIter last, Compare comp);
The sort
function template
sorts the range [first
, last
) in place. The sort is not stable, so
equivalent elements do not preserve their original order.
The first version compares items using the <
operator. The second version uses
comp(X
, Y)
to test whether X
<
Y
.