diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/list/generator/higher/list_tabulate.h | 2 | ||||
-rw-r--r-- | src/list/operation/higher/filter.h | 34 | ||||
-rw-r--r-- | src/list/operation/higher/map.h | 33 | ||||
-rw-r--r-- | src/list/operation/higher/misc.h | 56 | ||||
-rw-r--r-- | src/list/operation/higher/query.h | 2 |
5 files changed, 69 insertions, 58 deletions
diff --git a/src/list/generator/higher/list_tabulate.h b/src/list/generator/higher/list_tabulate.h index 9eee599..dd2914a 100644 --- a/src/list/generator/higher/list_tabulate.h +++ b/src/list/generator/higher/list_tabulate.h @@ -2,7 +2,7 @@ #define TYPEASVALUE_SRC_LIST_GENERATOR_HIGHER_LIST_TABULATE_H_ #include "list/generator/iota.h" -#include "list/operation/higher/misc.h" +#include "list/operation/higher/map.h" namespace tav { diff --git a/src/list/operation/higher/filter.h b/src/list/operation/higher/filter.h new file mode 100644 index 0000000..8788aed --- /dev/null +++ b/src/list/operation/higher/filter.h @@ -0,0 +1,34 @@ +#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FILTER_H_ +#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FILTER_H_ + +#include "fold.h" +#include "conditional/if.h" + +namespace tav { + +template < + template<typename> class Function, + typename List +> +class Filter { + private: + template < + typename Current, + typename Previous + > + struct function_wrapper { + typedef If< + Function<Current>::type::value, + Cons<Current, Previous>, + Previous + > type; + }; + + public: + typedef typename Fold<function_wrapper, void, List>::type type; + +}; + +} + +#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FILTER_H_ diff --git a/src/list/operation/higher/map.h b/src/list/operation/higher/map.h new file mode 100644 index 0000000..1c577ca --- /dev/null +++ b/src/list/operation/higher/map.h @@ -0,0 +1,33 @@ +#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MAP_H_ +#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MAP_H_ + +#include "fold.h" +#include "conditional/if.h" + +namespace tav { + +template < + template<typename> class Function, + typename List +> +class Map { + private: + template < + typename Current, + typename Previous + > + struct function_wrapper { + typedef Cons< + typename Function<Current>::type, + Previous + > type; + }; + + public: + typedef typename Fold<function_wrapper, void, List>::type type; + +}; + +} + +#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MAP_H_ diff --git a/src/list/operation/higher/misc.h b/src/list/operation/higher/misc.h deleted file mode 100644 index feec7de..0000000 --- a/src/list/operation/higher/misc.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MISC_H_ -#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MISC_H_ - -#include "fold.h" -#include "conditional/if.h" - -namespace tav { - -template < - template<typename> class Function, - typename List -> -class Map { - private: - template < - typename Current, - typename Previous - > - struct function_wrapper { - typedef Cons< - typename Function<Current>::type, - Previous - > type; - }; - - public: - typedef typename Fold<function_wrapper, void, List>::type type; - -}; - -template < - template<typename> class Function, - typename List -> -class Filter { - private: - template < - typename Current, - typename Previous - > - struct function_wrapper { - typedef If< - Function<Current>::type::value, - Cons<Current, Previous>, - Previous - > type; - }; - - public: - typedef typename Fold<function_wrapper, void, List>::type type; - -}; - -} - -#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MISC_H_ diff --git a/src/list/operation/higher/query.h b/src/list/operation/higher/query.h index c6eabc7..198ffa5 100644 --- a/src/list/operation/higher/query.h +++ b/src/list/operation/higher/query.h @@ -2,7 +2,7 @@ #define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_QUERY_H_ #include "fold.h" -#include "misc.h" +#include "map.h" #include "operation/math.h" #include "operation/logic.h" |