includes

template<class InIt1, class InIt2>
    bool includes(InIt1 first1, InIt1 last1,
        InIt2 first2, InIt2 last2);
template<class InIt1, class InIt2, class Pred>
    bool includes(InIt1 first1, InIt1 last1,
        InIt2 first2, InIt2 last2, Pred pr);

The first template function determines whether a value of N exists in the range [0, last2 - first2) such that, for each M in the range [0, last1 - first1), *(first + M) and *(first + N) do not have equivalent ordering, where the elements designated by iterators in the ranges [first1, last1) and [first2, last2) each form a sequence ordered by operator<. If so, the function returns false. If no such value exists, it returns true. Thus, the function determines whether the ordered sequence designated by iterators in the range [first2, last2) has equivalent ordering with some element designated by iterators in the range [first1, last1).

The function evaluates the predicate 2 * ((last1 - first1) + (last2 - first2)) - 1 times, at most.

The second template function behaves the same, except that it replaces operator<(X, Y) with pr(X, Y).

Sample programs: includes and includes (predicate version).