search
search
template<class FwdIt1, class FwdIt2>
FwdIt1 search(FwdIt1 first1, FwdIt1 last1,
FwdIt2 first2, FwdIt2 last2);
template<class FwdIt1, class FwdIt2, class Pred>
FwdIt1 search(FwdIt1 first1, FwdIt1 last1,
FwdIt2 first2, FwdIt2 last2, Pred pr);
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. It then returns first1 + N
. If no such value exists, the function returns last1
. It evaluates the predicate (last2 - first2) * (last1 - first1)
times, at most.
The second template function behaves the same, except that the predicate is pr(*(first1 + N + M), *(first2 + M))
.