diff options
Diffstat (limited to 'src/list/operation/higher/find.h')
-rw-r--r-- | src/list/operation/higher/find.h | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/src/list/operation/higher/find.h b/src/list/operation/higher/find.h index 48533b7..aeb0c2a 100644 --- a/src/list/operation/higher/find.h +++ b/src/list/operation/higher/find.h @@ -1,39 +1,25 @@ #ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FIND_H_ #define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FIND_H_ -#include "type.h" -#include "conditional/if.h" +#include "utility/predicate.h" +#include "function/apply.h" +#include "list/operation/nth.h" +#include "list_index.h" namespace tav { -namespace detail { - -template < - template<typename> class Predicate, - typename Current -> -struct Find { - typedef If< - Eval<Predicate<Head<Current>>>, - Head<Current>, - Eval<Find<Predicate, Tail<Current>>> - > type; -}; - -template < - template<typename> class Predicate -> -struct Find<Predicate, void> { - typedef Boolean<false> type; -}; - -} - template < template<typename> class Predicate, typename List > -using Find = Eval<detail::Find<Predicate, List>>; +using Find = typename utility::predicate_guard< + IsSize, + Apply<Nth, _0, List>::template function, + Boolean<false> +>::template check< + ListIndex<Predicate, List> +>; + } |