Standard C++ Library Reference ISO/IEC (VERSION3)

function then returns dest + K.
The merge occurs without altering the relative order of elements within either sequence.
Moreover, for two elements from different sequences that have equivalent ordering that would
otherwise be copied to adjacent elements, the function copies only the element from the ordered
range [first1, last1) and skips the other. Thus, the function merges two ordered
sequences to form another ordered sequence that is effectively the union of two sets.
If dest and first1 designate regions of storage, the range [dest, dest + K) must not
overlap the range [first1, last1). If dest and first2 designate regions of storage, the
range [dest, dest + K) must not overlap the range [first2, last2). The function
evaluates the ordering predicate X < Y at most 2 * ((last1 - first1) + (last2 -
first2)) - 1 times.
The second template function behaves the same, except that it replaces operator<(X, Y)
with pred(X, Y).
sort
template<class RanIt>
void sort(RanIt first, RanIt last);
template<class RanIt, class Pr>
void sort(RanIt first, RanIt last, Pr pred);
The first template function reorders the sequence designated by iterators in the range [first,
last) to form a sequence ordered by operator<. Thus, the elements are sorted in ascending
order.
The function evaluates the ordering predicate X < Y a number of times proportional to at most
ceil((last - first) * log(last - first)).
The second template function behaves the same, except that it replaces operator<(X, Y)
with pred(X, Y).
sort_heap
template<class RanIt>
void sort_heap(RanIt first, RanIt last);
template<class RanIt, class Pr>
void sort_heap(RanIt first, RanIt last, Pr pred);
The first template function reorders the sequence designated by iterators in the range [first,
last) to form a sequence that is ordered by operator<. The original sequence must
designate a heap, also ordered by operator<. Thus, the elements are sorted in ascending
order.