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

@ -5,6 +5,7 @@
#include <sprout/config.hpp>
#include <sprout/fixed_container/traits.hpp>
#include <sprout/fixed_container/functions.hpp>
#include <sprout/iterator/operation.hpp>
#include <sprout/algorithm/fixed/result_of.hpp>
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
@ -31,7 +32,7 @@ namespace sprout {
Args const&... args
)
{
return set_intersection_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args)));
return set_intersection_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args)));
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
@ -69,13 +70,13 @@ namespace sprout {
? first1 != last1
? first2 != last2
? comp(*first1, *first2)
? set_intersection_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args...)
? set_intersection_impl_2(sprout::next(first1), last1, first2, last2, result, comp, offset, args...)
: comp(*first2, *first1)
? set_intersection_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args...)
: set_intersection_impl_2(first1 + 1, last1, first2 + 1, last2, result, comp, offset, args..., *first1)
: set_intersection_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args...)
? set_intersection_impl_2(first1, last1, sprout::next(first2), last2, result, comp, offset, args...)
: set_intersection_impl_2(sprout::next(first1), last1, sprout::next(first2), last2, result, comp, offset, args..., *first1)
: set_intersection_impl_2(sprout::next(first1), last1, first2, last2, result, comp, offset, args...)
: first2 != last2
? set_intersection_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args...)
? set_intersection_impl_2(first1, last1, sprout::next(first2), last2, result, comp, offset, args...)
: set_intersection_impl_3(result, args...)
: set_intersection_impl_3(result, args...)
;
@ -113,7 +114,7 @@ namespace sprout {
)
{
return sizeof...(Args) < offset
? set_intersection_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args)))
? set_intersection_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args)))
: set_intersection_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...)
;
}