From 5527449e26541a542ab06a8187bb8853e1777968 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Wed, 19 Mar 2014 00:53:52 +0900 Subject: [PATCH] fix type/seq/algorithm/ --- sprout/type/seq/algorithm/find.hpp | 45 +++++++++++++++++---------- sprout/type/seq/algorithm/find_if.hpp | 45 +++++++++++++++++---------- 2 files changed, 56 insertions(+), 34 deletions(-) diff --git a/sprout/type/seq/algorithm/find.hpp b/sprout/type/seq/algorithm/find.hpp index 75bac80b..4deff0ba 100644 --- a/sprout/type/seq/algorithm/find.hpp +++ b/sprout/type/seq/algorithm/find.hpp @@ -18,6 +18,33 @@ namespace sprout { namespace detail { template struct find_impl; + + template + struct find_impl_1; + template + struct find_impl_1< + First, Last, T, + typename std::enable_if< + std::is_same::type, T>::value + >::type + > { + public: + typedef First type; + }; + template + struct find_impl_1< + First, Last, T, + typename std::enable_if< + !std::is_same::type, T>::value + >::type + > + : public sprout::types::seq::detail::find_impl< + typename sprout::types::next::type, + Last, + T + > + {}; + template struct find_impl< First, Last, T, @@ -33,25 +60,9 @@ namespace sprout { First, Last, T, typename std::enable_if< !std::is_same::value - && std::is_same::type, T>::value - >::type - > { - public: - typedef First type; - }; - template - struct find_impl< - First, Last, T, - typename std::enable_if< - !std::is_same::value - && !std::is_same::type, T>::value >::type > - : public sprout::types::seq::detail::find_impl< - typename sprout::types::next::type, - Last, - T - > + : public sprout::types::seq::detail::find_impl_1 {}; } // namespace detail // diff --git a/sprout/type/seq/algorithm/find_if.hpp b/sprout/type/seq/algorithm/find_if.hpp index 9ca08632..fb7cb808 100644 --- a/sprout/type/seq/algorithm/find_if.hpp +++ b/sprout/type/seq/algorithm/find_if.hpp @@ -18,6 +18,33 @@ namespace sprout { namespace detail { template struct find_if_impl; + + template + struct find_if_impl_1; + template + struct find_if_impl_1< + First, Last, Predicate, + typename std::enable_if< + Predicate::template apply::type>::type::value + >::type + > { + public: + typedef First type; + }; + template + struct find_if_impl_1< + First, Last, Predicate, + typename std::enable_if< + !Predicate::template apply::type>::type::value + >::type + > + : public sprout::types::seq::detail::find_if_impl< + typename sprout::types::next::type, + Last, + Predicate + > + {}; + template struct find_if_impl< First, Last, Predicate, @@ -33,25 +60,9 @@ namespace sprout { First, Last, Predicate, typename std::enable_if< !std::is_same::value - && Predicate::template apply::type>::type::value - >::type - > { - public: - typedef First type; - }; - template - struct find_if_impl< - First, Last, Predicate, - typename std::enable_if< - !std::is_same::value - && !Predicate::template apply::type>::type::value >::type > - : public sprout::types::seq::detail::find_if_impl< - typename sprout::types::next::type, - Last, - Predicate - > + : public sprout::types::seq::detail::find_if_impl_1 {}; } // namespace detail //