aboutsummaryrefslogtreecommitdiff
path: root/src/list/operation/higher
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-02-06 19:26:26 +0100
committerAdrian Kummerlaender2015-02-06 19:26:26 +0100
commit27aaee43499c268903332c7e9e1e6ec2d193dc3a (patch)
treefcd6a361aa5ce6a9c095f496886807f87af85ea0 /src/list/operation/higher
parent1e0528b1a870e0e0f2b15f468fc60f80e5fc20b3 (diff)
downloadTypeAsValue-27aaee43499c268903332c7e9e1e6ec2d193dc3a.tar
TypeAsValue-27aaee43499c268903332c7e9e1e6ec2d193dc3a.tar.gz
TypeAsValue-27aaee43499c268903332c7e9e1e6ec2d193dc3a.tar.bz2
TypeAsValue-27aaee43499c268903332c7e9e1e6ec2d193dc3a.tar.lz
TypeAsValue-27aaee43499c268903332c7e9e1e6ec2d193dc3a.tar.xz
TypeAsValue-27aaee43499c268903332c7e9e1e6ec2d193dc3a.tar.zst
TypeAsValue-27aaee43499c268903332c7e9e1e6ec2d193dc3a.zip
Revamped to use `Cons` as a function and `Pair` as its result
* this is analogous to _Scheme_ where a pair (dot-expression) is returned from a call to `cons` * `Head` and `Tail` are kept as direct references to the `CAR` and `CDR` values of a pair to match e.g. the math operators
Diffstat (limited to 'src/list/operation/higher')
-rw-r--r--src/list/operation/higher/filter.h2
-rw-r--r--src/list/operation/higher/map.h10
-rw-r--r--src/list/operation/higher/partition.h10
-rw-r--r--src/list/operation/higher/take_while.h4
4 files changed, 11 insertions, 15 deletions
diff --git a/src/list/operation/higher/filter.h b/src/list/operation/higher/filter.h
index 3fc08ee..acc1422 100644
--- a/src/list/operation/higher/filter.h
+++ b/src/list/operation/higher/filter.h
@@ -18,7 +18,7 @@ class Filter {
>
using predicate_wrapper = If<
Predicate<Current>::type::value,
- Cons<Current, Previous>,
+ typename Cons<Current, Previous>::type,
Previous
>;
diff --git a/src/list/operation/higher/map.h b/src/list/operation/higher/map.h
index a451b2a..9cb6524 100644
--- a/src/list/operation/higher/map.h
+++ b/src/list/operation/higher/map.h
@@ -15,12 +15,10 @@ class Map {
typename Current,
typename Previous
>
- struct function_wrapper {
- typedef Cons<
- typename Function<Current>::type,
- Previous
- > type;
- };
+ using function_wrapper = Cons<
+ typename Function<Current>::type,
+ Previous
+ >;
public:
typedef typename Fold<function_wrapper, void, List>::type type;
diff --git a/src/list/operation/higher/partition.h b/src/list/operation/higher/partition.h
index e42b971..a0ea379 100644
--- a/src/list/operation/higher/partition.h
+++ b/src/list/operation/higher/partition.h
@@ -9,12 +9,10 @@ template <
template<typename> class Predicate,
typename List
>
-struct Partition {
- typedef Cons<
- typename Filter<Predicate, List>::type,
- typename Remove<Predicate, List>::type
- > type;
-};
+using Partition = Cons<
+ typename Filter<Predicate, List>::type,
+ typename Remove<Predicate, List>::type
+>;
}
diff --git a/src/list/operation/higher/take_while.h b/src/list/operation/higher/take_while.h
index 27f58ed..d04dc2d 100644
--- a/src/list/operation/higher/take_while.h
+++ b/src/list/operation/higher/take_while.h
@@ -12,10 +12,10 @@ template <
struct TakeWhile {
typedef typename If<
Predicate<Head<Current>>::type::value,
- Cons<
+ typename Cons<
Head<Current>,
typename TakeWhile<Predicate, Tail<Current>>::type
- >,
+ >::type,
void
>::type type;
};