Standard C++ Library Reference ISO/IEC (VERSION3)

The first template function determines the lowest value of N in the range [0, (last1 -
first1) - (last2 - first2)) such that for each M in the range [0, last2 -
first2), the predicate *(first1 + N + M) == *(first2 + M) is true. Here,
operator== must perform a pairwise comparison between its operands. It then returns
first1 + N. If no such value exists, the function returns last1. It evaluates the predicate at
most (last2 - first2) * (last1 - first1) times.
The second template function behaves the same, except that the predicate is pred(*(first1
+ N + M), *(first2 + M)).
search_n
template<class FwdIt1, class Diff2, class Ty>
FwdIt1 search_n(FwdIt1 first1, FwdIt1 last1,
Diff2 count, const Ty& val);
template<class FwdIt1, class Diff2, class Ty, class Pr>
FwdIt1 search_n(FwdIt1 first1, FwdIt1 last1,
Diff2 count, const Ty& val, Pr pred);
The first template function determines the lowest value of N in the range [0, (last -
first) - count) such that for each M in the range [0, count), the predicate *(first
+ N + M) == val is true. Here, operator== must perform a pairwise comparison
between its operands. It then returns first + N. If no such value exists, the function returns
last. It evaluates the predicate at most count * (last - first) times.
The second template function behaves the same, except that the predicate is pred(*(first +
N + M), val).
set_difference
template<class InIt1, class InIt2, class OutIt>
OutIt set_difference(InIt1 first1, InIt1 last1,
InIt2 first2, InIt2 last2, OutIt dest);
template<class InIt1, class InIt2, class OutIt,
class Pr>
OutIt set_difference(InIt1 first1, InIt1 last1,
InIt2 first2, InIt2 last2, OutIt dest, Pr pred);
The first template function alternately copies values from two sequences designated by iterators
in the ranges [first1, last1) and [first2, last2), both 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 two elements from different sequences that have equivalent ordering that would