From 1e0528b1a870e0e0f2b15f468fc60f80e5fc20b3 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Thu, 5 Feb 2015 17:13:39 +0100 Subject: 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 --- src/list/operation/higher/drop_while.h | 4 ++-- src/list/operation/higher/filter.h | 12 +++++------- src/list/operation/higher/find.h | 4 ++-- src/list/operation/higher/take_while.h | 4 ++-- 4 files changed, 11 insertions(+), 13 deletions(-) (limited to 'src/list') 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>::type::value, typename DropWhile>::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::type::value, - Cons, - Previous - > type; - }; + using predicate_wrapper = If< + Predicate::type::value, + Cons, + Previous + >; public: typedef typename Fold::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>::type::value, Head, typename Find>::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>::type::value, Cons< Head, typename TakeWhile>::type >, void - > type; + >::type type; }; template < -- cgit v1.2.3