fix type/seq/algorithm/

This commit is contained in:
bolero-MURAKAMI 2014-03-19 00:53:52 +09:00
parent 6e09fc2ee5
commit 5527449e26
2 changed files with 56 additions and 34 deletions

View file

@ -18,6 +18,33 @@ namespace sprout {
namespace detail {
template<typename First, typename Last, typename T, typename = void>
struct find_impl;
template<typename First, typename Last, typename T, typename = void>
struct find_impl_1;
template<typename First, typename Last, typename T>
struct find_impl_1<
First, Last, T,
typename std::enable_if<
std::is_same<typename sprout::types::deref<First>::type, T>::value
>::type
> {
public:
typedef First type;
};
template<typename First, typename Last, typename T>
struct find_impl_1<
First, Last, T,
typename std::enable_if<
!std::is_same<typename sprout::types::deref<First>::type, T>::value
>::type
>
: public sprout::types::seq::detail::find_impl<
typename sprout::types::next<First>::type,
Last,
T
>
{};
template<typename First, typename Last, typename T>
struct find_impl<
First, Last, T,
@ -33,25 +60,9 @@ namespace sprout {
First, Last, T,
typename std::enable_if<
!std::is_same<First, Last>::value
&& std::is_same<typename sprout::types::deref<First>::type, T>::value
>::type
> {
public:
typedef First type;
};
template<typename First, typename Last, typename T>
struct find_impl<
First, Last, T,
typename std::enable_if<
!std::is_same<First, Last>::value
&& !std::is_same<typename sprout::types::deref<First>::type, T>::value
>::type
>
: public sprout::types::seq::detail::find_impl<
typename sprout::types::next<First>::type,
Last,
T
>
: public sprout::types::seq::detail::find_impl_1<First, Last, T>
{};
} // namespace detail
//

View file

@ -18,6 +18,33 @@ namespace sprout {
namespace detail {
template<typename First, typename Last, typename Predicate, typename = void>
struct find_if_impl;
template<typename First, typename Last, typename Predicate, typename = void>
struct find_if_impl_1;
template<typename First, typename Last, typename Predicate>
struct find_if_impl_1<
First, Last, Predicate,
typename std::enable_if<
Predicate::template apply<typename sprout::types::deref<First>::type>::type::value
>::type
> {
public:
typedef First type;
};
template<typename First, typename Last, typename Predicate>
struct find_if_impl_1<
First, Last, Predicate,
typename std::enable_if<
!Predicate::template apply<typename sprout::types::deref<First>::type>::type::value
>::type
>
: public sprout::types::seq::detail::find_if_impl<
typename sprout::types::next<First>::type,
Last,
Predicate
>
{};
template<typename First, typename Last, typename Predicate>
struct find_if_impl<
First, Last, Predicate,
@ -33,25 +60,9 @@ namespace sprout {
First, Last, Predicate,
typename std::enable_if<
!std::is_same<First, Last>::value
&& Predicate::template apply<typename sprout::types::deref<First>::type>::type::value
>::type
> {
public:
typedef First type;
};
template<typename First, typename Last, typename Predicate>
struct find_if_impl<
First, Last, Predicate,
typename std::enable_if<
!std::is_same<First, Last>::value
&& !Predicate::template apply<typename sprout::types::deref<First>::type>::type::value
>::type
>
: public sprout::types::seq::detail::find_if_impl<
typename sprout::types::next<First>::type,
Last,
Predicate
>
: public sprout::types::seq::detail::find_if_impl_1<First, Last, Predicate>
{};
} // namespace detail
//