cpp/algorithm/set union

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

If contains  elements that are equivalent to each other and  contains  elements that are equivalent to them, then all  elements will be copied from  to the output range, preserving order, and then the final  elements will be copied from  to the output range, also preserving order.

@1@ Elements are compared using and the ranges must be sorted with respect to the same. @3@ Elements are compared using the given binary comparison function and the ranges must be sorted with respect to the same. @2,4@ Same as, but executed according to.

If either of the input ranges is not sorted (using or, respectively) or overlaps with the output range, the behavior is undefined.

Return value
Iterator past the end of the constructed range.

Complexity
Given and  as  and  respectively: @1,2@ at most comparisons using @3,4@ at most applications of the predicate