cpp/algorithm/ranges/set union

Constructs a sorted union beginning at consisting of the set of elements present in one or both sorted input ranges  and.

If some element is found times in  and  times in, then all  elements will be copied from  to , preserving order, and then exactly  elements will be copied from  to , also preserving order.

The behavior is undefined if
 * the input ranges are not sorted with respect to and  or, respectively, or
 * the resulting range overlaps with either of the input ranges.

@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.

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

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