1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

algorithm を next/prev で再実装

This commit is contained in:
bolero-MURAKAMI 2011-10-02 00:19:13 +09:00
parent 6fe7e88509
commit 628d1caa7e
50 changed files with 310 additions and 189 deletions

View file

@ -3,6 +3,7 @@
#include <iterator>
#include <sprout/config.hpp>
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace detail {
@ -17,8 +18,8 @@ namespace sprout {
return first == last
? 0
: *first == value
? 1 + sprout::detail::overlap_count_impl(first + 1, last, value)
: sprout::detail::overlap_count_impl(first + 1, last, *first)
? 1 + sprout::detail::overlap_count_impl(sprout::next(first), last, value)
: sprout::detail::overlap_count_impl(sprout::next(first), last, *first)
;
}
//
@ -32,7 +33,7 @@ namespace sprout {
{
return first == last
? 0
: sprout::detail::overlap_count_impl(first + 1, last, *first)
: sprout::detail::overlap_count_impl(sprout::next(first), last, *first)
;
}
@ -47,8 +48,8 @@ namespace sprout {
return first == last
? 0
: pred(*first, value)
? 1 + sprout::detail::overlap_count_impl(first + 1, last, pred, value)
: sprout::detail::overlap_count_impl(first + 1, last, pred, *first)
? 1 + sprout::detail::overlap_count_impl(sprout::next(first), last, pred, value)
: sprout::detail::overlap_count_impl(sprout::next(first), last, pred, *first)
;
}
//
@ -63,7 +64,7 @@ namespace sprout {
{
return first == last
? 0
: sprout::detail::overlap_count_impl(first + 1, last, pred, *first)
: sprout::detail::overlap_count_impl(sprout::next(first), last, pred, *first)
;
}
} // namespace detail