cpp/algorithm/ranges/set intersection

Constructs a sorted range beginning at consisting of elements that are found in both sorted input ranges  and. If some element is found times in  and  times in, the first  elements will be copied from the first range to. The order of equivalent elements is preserved.

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.