aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/higher/map.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-02-15 22:37:06 +0100
committerAdrian Kummerlaender2015-02-15 22:37:06 +0100
commita59df7e8c4fd1f88bc1078ebcfde944502b0c309 (patch)
tree5e5ecdf040a8b5fdebff55ec489a03ffea38501f /src/list/operation/higher/map.h
parent8e49cc6f8f2186ef028bfa765fd06e52ce5218c5 (diff)
downloadTypeAsValue-a59df7e8c4fd1f88bc1078ebcfde944502b0c309.tar
TypeAsValue-a59df7e8c4fd1f88bc1078ebcfde944502b0c309.tar.gz
TypeAsValue-a59df7e8c4fd1f88bc1078ebcfde944502b0c309.tar.bz2
TypeAsValue-a59df7e8c4fd1f88bc1078ebcfde944502b0c309.tar.lz
TypeAsValue-a59df7e8c4fd1f88bc1078ebcfde944502b0c309.tar.xz
TypeAsValue-a59df7e8c4fd1f88bc1078ebcfde944502b0c309.tar.zst
TypeAsValue-a59df7e8c4fd1f88bc1078ebcfde944502b0c309.zip
Simplified `Cond`, `Cons` and `Map` implementations
* continuation of 8e49cc6f8f
Diffstat (limited to 'src/list/operation/higher/map.h')
-rw-r--r--src/list/operation/higher/map.h34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/list/operation/higher/map.h b/src/list/operation/higher/map.h
index cc30355..00956a5 100644
--- a/src/list/operation/higher/map.h
+++ b/src/list/operation/higher/map.h
@@ -7,24 +7,16 @@ namespace tav {
namespace detail {
-template <
- template<typename> class Function,
- typename List
->
-class Map {
- private:
- template <
- typename Current,
- typename Previous
- >
- using function_wrapper = Cons<
- Eval<Function<Current>>,
- Previous
- >;
-
- public:
- using type = tav::Fold<function_wrapper, void, List>;
-
+template <template<typename> class Function>
+struct map_transformation {
+ template <
+ typename Current,
+ typename Previous
+ >
+ using function = Cons<
+ Eval<Function<Current>>,
+ Previous
+ >;
};
}
@@ -33,7 +25,11 @@ template <
template<typename> class Function,
typename List
>
-using Map = Eval<detail::Map<Function, List>>;
+using Map = Fold<
+ detail::map_transformation<Function>::template function,
+ void,
+ List
+>;
}