template<class FwdIt, class Dist, class T>
FwdIt search_n(FwdIt first, FwdIt last,
Dist n, const T& val);
template<class FwdIt, class Dist, class T, class Pred>
FwdIt search_n(FwdIt first, FwdIt last,
Dist n, const T& val, Pred pr);
The first template function determines the lowest value of N
in the range [0, (last - first) - n)
such that for
each M
in the range [0, n)
, the predicate *(first + N + M) == val
is true. It then returns first + N
. If no such
value exists, the function returns last
. It evaluates the predicate n * (last - first)
times, at most.
The second template function behaves the same, except that the predicate is pr(*(first + N + M), val)
.