cpp/algorithm/ranges/merge

Merges two sorted ranges and  into one sorted range beginning at.

A sequence is said to be sorted with respect to the 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,  evaluates to.

@1@ Elements are compared using the given binary comparison function.

@2@ Same as, but uses as the first range and  as the second range, as if using  as ,  as ,  as , and  as.

The behavior is undefined if the destination range overlaps either of the input ranges (the input ranges may overlap each other).

This merge function is stable, which means that for equivalent elements in the original two ranges, the elements from the first range (preserving their original order) precede the elements from the second range (preserving their original order).

Return value
, where is the end of the constructed range.

Complexity
At most comparisons and applications of each projection, where .