mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-11-14 10:39:05 +00:00
fix type/seq/algorithm/
This commit is contained in:
parent
6e09fc2ee5
commit
5527449e26
2 changed files with 56 additions and 34 deletions
|
@ -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
|
||||
//
|
||||
|
|
|
@ -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
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue