Standard C++ Library Reference ISO/IEC (VERSION3)
N) < *(first + M) is false. It then returns first + N. Thus, the function determines the
lowest position that contains the largest value in the sequence.
The function evaluates the ordering predicate X < Y exactly max((last - first) - 1,
0) times.
The second template function behaves the same, except that it replaces operator<(X, Y)
with pred(X, Y).
merge
template<class InIt1, class InIt2, class OutIt>
OutIt merge(InIt1 first1, InIt1 last1,
InIt2 first2, InIt2 last2, OutIt dest);
template<class InIt1, class InIt2, class OutIt,
class Pr>
OutIt merge(InIt1 first1, InIt1 last1,
InIt2 first2, InIt2 last2, OutIt dest, Pr pred);
The first template function determines K, the number of elements to copy as (last1 -
first1) + (last2 - first2). It then alternately copies two sequences, designated by
iterators in the ranges [first1, last1) and [first2, last2) and each ordered by
operator<, to form a merged sequence of length K beginning at dest, also ordered by
operator<. The function then returns dest + K.
The merge occurs without altering the relative order of elements within either sequence.
Moreover, for any two elements from different sequences that have equivalent ordering, the
element from the ordered range [first1, last1) precedes the other. Thus, the function
merges two ordered sequences to form another ordered sequence.
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 K - 1 times.
The second template function behaves the same, except that it replaces operator<(X, Y)
with pred(X, Y).
min
template<class Ty>
const Ty& min(const Ty& left, const Ty& right);
template<class Ty, class Pr>
const Ty& min(const Ty& left, const Ty& right, Pr pred);
The first template function returns right if right < left. Otherwise it returns left. Ty