diff options
Diffstat (limited to 'src/list/operation/higher/filter.h')
-rw-r--r-- | src/list/operation/higher/filter.h | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/list/operation/higher/filter.h b/src/list/operation/higher/filter.h index 17d49c2..9dcdf37 100644 --- a/src/list/operation/higher/filter.h +++ b/src/list/operation/higher/filter.h @@ -8,25 +8,17 @@ namespace tav { namespace detail { -template < - template<typename> class Predicate, - typename List -> -class Filter { - private: - template < - typename Current, - typename Previous - > - using predicate_wrapper = If< - Eval<Predicate<Current>>, - Cons<Current, Previous>, - Previous - >; - - public: - typedef tav::Fold<predicate_wrapper, void, List> type; - +template <template<typename> class Predicate> +struct filter_predicate { + template < + typename Current, + typename Previous + > + using function = If< + Eval<Predicate<Current>>, + Cons<Current, Previous>, + Previous + >; }; } @@ -35,7 +27,11 @@ template < template<typename> class Predicate, typename List > -using Filter = Eval<detail::Filter<Predicate, List>>; +using Filter = Fold< + detail::filter_predicate<Predicate>::template function, + void, + List +>; } |