aboutsummaryrefslogtreecommitdiff
path: root/src/list/cons.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-02-15 14:07:50 +0100
committerAdrian Kummerlaender2015-02-15 14:07:50 +0100
commit46e174935b122c0da4b51532a7f683a512eeaf65 (patch)
tree88bed0d869ce40c460e6370b4954ff159fe3c575 /src/list/cons.h
parente24f25ada7e8f48dc35cb235e045a4324bccb4f2 (diff)
downloadTypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar
TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.gz
TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.bz2
TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.lz
TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.xz
TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.tar.zst
TypeAsValue-46e174935b122c0da4b51532a7f683a512eeaf65.zip
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
Diffstat (limited to 'src/list/cons.h')
-rw-r--r--src/list/cons.h26
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_