aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-02-05 17:13:39 +0100
committerAdrian Kummerlaender2015-02-05 17:13:39 +0100
commit1e0528b1a870e0e0f2b15f468fc60f80e5fc20b3 (patch)
treea8ec087590596694f1e80def81f08236b5399cb9 /src
parent868f7d2c46302f3f993ff8f7943823243a5d1a6d (diff)
downloadTypeAsValue-1e0528b1a870e0e0f2b15f468fc60f80e5fc20b3.tar
TypeAsValue-1e0528b1a870e0e0f2b15f468fc60f80e5fc20b3.tar.gz
TypeAsValue-1e0528b1a870e0e0f2b15f468fc60f80e5fc20b3.tar.bz2
TypeAsValue-1e0528b1a870e0e0f2b15f468fc60f80e5fc20b3.tar.lz
TypeAsValue-1e0528b1a870e0e0f2b15f468fc60f80e5fc20b3.tar.xz
TypeAsValue-1e0528b1a870e0e0f2b15f468fc60f80e5fc20b3.tar.zst
TypeAsValue-1e0528b1a870e0e0f2b15f468fc60f80e5fc20b3.zip
Defer `If` template resolution analogously to other functions
* all other functions sans `Cons` are resolved when the respective member `*::type` is instantiated * this was changed soely to increase coherence
Diffstat (limited to 'src')
-rw-r--r--src/conditional/if.h4
-rw-r--r--src/list/operation/higher/drop_while.h4
-rw-r--r--src/list/operation/higher/filter.h12
-rw-r--r--src/list/operation/higher/find.h4
-rw-r--r--src/list/operation/higher/take_while.h4
5 files changed, 13 insertions, 15 deletions
diff --git a/src/conditional/if.h b/src/conditional/if.h
index b9568f6..b019674 100644
--- a/src/conditional/if.h
+++ b/src/conditional/if.h
@@ -10,11 +10,11 @@ template <
typename TrueBranch,
typename FalseBranch
>
-using If = typename std::conditional<
+using If = std::conditional<
Condition,
TrueBranch,
FalseBranch
->::type;
+>;
}
diff --git a/src/list/operation/higher/drop_while.h b/src/list/operation/higher/drop_while.h
index a6ab8c4..ad1553f 100644
--- a/src/list/operation/higher/drop_while.h
+++ b/src/list/operation/higher/drop_while.h
@@ -10,11 +10,11 @@ template <
typename Current
>
struct DropWhile {
- typedef If<
+ typedef typename If<
Predicate<Head<Current>>::type::value,
typename DropWhile<Predicate, Tail<Current>>::type,
Current
- > type;
+ >::type type;
};
template <
diff --git a/src/list/operation/higher/filter.h b/src/list/operation/higher/filter.h
index d91735e..3fc08ee 100644
--- a/src/list/operation/higher/filter.h
+++ b/src/list/operation/higher/filter.h
@@ -16,13 +16,11 @@ class Filter {
typename Current,
typename Previous
>
- struct predicate_wrapper {
- typedef If<
- Predicate<Current>::type::value,
- Cons<Current, Previous>,
- Previous
- > type;
- };
+ using predicate_wrapper = If<
+ Predicate<Current>::type::value,
+ Cons<Current, Previous>,
+ Previous
+ >;
public:
typedef typename Fold<predicate_wrapper, void, List>::type type;
diff --git a/src/list/operation/higher/find.h b/src/list/operation/higher/find.h
index 47b88ad..bf9d04f 100644
--- a/src/list/operation/higher/find.h
+++ b/src/list/operation/higher/find.h
@@ -11,11 +11,11 @@ template <
typename Current
>
struct Find {
- typedef If<
+ typedef typename If<
Predicate<Head<Current>>::type::value,
Head<Current>,
typename Find<Predicate, Tail<Current>>::type
- > type;
+ >::type type;
};
template <
diff --git a/src/list/operation/higher/take_while.h b/src/list/operation/higher/take_while.h
index 1ee6736..27f58ed 100644
--- a/src/list/operation/higher/take_while.h
+++ b/src/list/operation/higher/take_while.h
@@ -10,14 +10,14 @@ template <
typename Current
>
struct TakeWhile {
- typedef If<
+ typedef typename If<
Predicate<Head<Current>>::type::value,
Cons<
Head<Current>,
typename TakeWhile<Predicate, Tail<Current>>::type
>,
void
- > type;
+ >::type type;
};
template <