From 46e174935b122c0da4b51532a7f683a512eeaf65 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 15 Feb 2015 14:07:50 +0100 Subject: Moved class-based implementations into `detail` namespace * while class templates enable e.g. hiding implementation details they also require evaluation via `Eval` ** this clutters up the actual logic and is now hidden behind aliae that perform the evaluation --- src/list/cons.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/list/cons.h') diff --git a/src/list/cons.h b/src/list/cons.h index 8efca67..95783b2 100644 --- a/src/list/cons.h +++ b/src/list/cons.h @@ -5,18 +5,12 @@ namespace tav { -template < - typename CAR, - typename CDR -> -struct Cons { - typedef Pair type; -}; +namespace detail { template struct Car { static_assert( - Eval>::value, + IsPair::value, "Pair type required" ); @@ -26,7 +20,7 @@ struct Car { template struct Cdr { static_assert( - Eval>::value, + IsPair::value, "Pair type required" ); @@ -35,4 +29,18 @@ struct Cdr { } +template < + typename CAR, + typename CDR +> +using Cons = Pair; + +template +using Car = Eval>; + +template +using Cdr = Eval>; + +} + #endif // TYPEASVALUE_SRC_LIST_CONS_H_ -- cgit v1.2.3