#ifndef SPROUT_ALGORITHM_NEXT_INTERSECTION_HPP #define SPROUT_ALGORITHM_NEXT_INTERSECTION_HPP #include #include #include #include #include namespace sprout { // // next_intersection // // recursion depth: // O(log(N1+N2)) // template inline SPROUT_CONSTEXPR sprout::pair next_intersection( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp ) { typedef sprout::pair type; return first1 == last1 || first2 == last2 ? type(last1, last2) : sprout::find_intersection(sprout::next(first1), last1, sprout::next(first2), last2, comp) ; } template inline SPROUT_CONSTEXPR sprout::pair next_intersection( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2 ) { return sprout::next_intersection(first1, last1, first2, last2, sprout::less<>()); } } // namespace sprout #endif // #ifndef SPROUT_ALGORITHM_NEXT_INTERSECTION_HPP