2011-09-01 02:48:32 +00:00
|
|
|
#ifndef SPROUT_DETAIL_OVERLAP_COUNT_2_HPP
|
|
|
|
#define SPROUT_DETAIL_OVERLAP_COUNT_2_HPP
|
|
|
|
|
|
|
|
#include <iterator>
|
|
|
|
#include <sprout/config.hpp>
|
2011-10-01 15:19:13 +00:00
|
|
|
#include <sprout/iterator/operation.hpp>
|
2011-09-01 02:48:32 +00:00
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
namespace detail {
|
|
|
|
//
|
|
|
|
// overlap_count_2
|
|
|
|
//
|
|
|
|
template<typename Iterator1, typename Iterator2, typename Compare>
|
2012-04-04 13:23:41 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename std::iterator_traits<Iterator1>::difference_type overlap_count_2(
|
2011-09-01 02:48:32 +00:00
|
|
|
Iterator1 first1,
|
|
|
|
Iterator1 last1,
|
|
|
|
Iterator2 first2,
|
|
|
|
Iterator2 last2,
|
|
|
|
Compare comp
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return first1 != last1 && first2 != last2
|
|
|
|
? comp(*first1, *first2)
|
2011-10-01 15:19:13 +00:00
|
|
|
? sprout::detail::overlap_count_2(sprout::next(first1), last1, first2, last2, comp)
|
2011-09-01 02:48:32 +00:00
|
|
|
: comp(*first2, *first1)
|
2011-10-01 15:19:13 +00:00
|
|
|
? sprout::detail::overlap_count_2(first1, last1, sprout::next(first2), last2, comp)
|
|
|
|
: 1 + sprout::detail::overlap_count_2(sprout::next(first1), last1, sprout::next(first2), last2, comp)
|
2011-09-01 02:48:32 +00:00
|
|
|
: 0
|
|
|
|
;
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// overlap_count_2
|
|
|
|
//
|
|
|
|
template<typename Iterator1, typename Iterator2>
|
2012-04-04 13:23:41 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename std::iterator_traits<Iterator1>::difference_type overlap_count_2(
|
2011-09-01 02:48:32 +00:00
|
|
|
Iterator1 first1,
|
|
|
|
Iterator1 last1,
|
|
|
|
Iterator2 first2,
|
|
|
|
Iterator2 last2
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return first1 != last1 && first2 != last2
|
|
|
|
? *first1 < *first2
|
2011-10-01 15:19:13 +00:00
|
|
|
? sprout::detail::overlap_count_2(sprout::next(first1), last1, first2, last2)
|
2011-09-01 02:48:32 +00:00
|
|
|
: *first2 < *first1
|
2011-10-01 15:19:13 +00:00
|
|
|
? sprout::detail::overlap_count_2(first1, last1, sprout::next(first2), last2)
|
|
|
|
: 1 + sprout::detail::overlap_count_2(sprout::next(first1), last1, sprout::next(first2), last2)
|
2011-09-01 02:48:32 +00:00
|
|
|
: 0
|
|
|
|
;
|
|
|
|
}
|
|
|
|
} // namespace detail
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_DETAIL_OVERLAP_COUNT_2_HPP
|