diff options
author | Adrian Kummerlaender | 2015-01-30 19:07:22 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-01-30 19:07:22 +0100 |
commit | e176dbe160eff01d172a11e7a191f756d4c87712 (patch) | |
tree | 4f1da0fd7421e4e17a5cc1cec73d09f66f3d095b /src | |
parent | 5f98c3eb62f3085a69f8df36de663bb7c6107341 (diff) | |
download | TypeAsValue-e176dbe160eff01d172a11e7a191f756d4c87712.tar TypeAsValue-e176dbe160eff01d172a11e7a191f756d4c87712.tar.gz TypeAsValue-e176dbe160eff01d172a11e7a191f756d4c87712.tar.bz2 TypeAsValue-e176dbe160eff01d172a11e7a191f756d4c87712.tar.lz TypeAsValue-e176dbe160eff01d172a11e7a191f756d4c87712.tar.xz TypeAsValue-e176dbe160eff01d172a11e7a191f756d4c87712.tar.zst TypeAsValue-e176dbe160eff01d172a11e7a191f756d4c87712.zip |
Separated `Map` and `Filter`
* there is no reason to keep them in the same header
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" |