diff options
Diffstat (limited to 'src/list/cons.h')
-rw-r--r-- | src/list/cons.h | 26 |
1 files changed, 17 insertions, 9 deletions
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<CAR, CDR> type; -}; +namespace detail { template <typename Pair> struct Car { static_assert( - Eval<IsPair<Pair>>::value, + IsPair<Pair>::value, "Pair type required" ); @@ -26,7 +20,7 @@ struct Car { template <typename Pair> struct Cdr { static_assert( - Eval<IsPair<Pair>>::value, + IsPair<Pair>::value, "Pair type required" ); @@ -35,4 +29,18 @@ struct Cdr { } +template < + typename CAR, + typename CDR +> +using Cons = Pair<CAR, CDR>; + +template <typename Pair> +using Car = Eval<detail::Car<Pair>>; + +template <typename Pair> +using Cdr = Eval<detail::Cdr<Pair>>; + +} + #endif // TYPEASVALUE_SRC_LIST_CONS_H_ |