Share via


find_end

find_end

template<class FwdIt1, class FwdIt2>
    FwdIt1 find_end(FwdIt1 first1, FwdIt1 last1,
        FwdIt2 first2, FwdIt2 last2);
template<class FwdIt1, class FwdIt2, class Pred>
    FwdIt1 find_end(FwdIt1 first1, FwdIt1 last1,
        FwdIt2 first2, FwdIt2 last2, Pred pr);

The first template function determines the highest 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 + N + 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 - (last2 - first2) + 1) times, at most.

The second template function behaves the same, except that the predicate is pr(*(first1 + N + M), *(first2 + N + M)).