blob: 95783b2eaab5c6a742810185398d00f7170b49d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#ifndef TYPEASVALUE_SRC_LIST_CONS_H_
#define TYPEASVALUE_SRC_LIST_CONS_H_
#include "pair.h"
namespace tav {
namespace detail {
template <typename Pair>
struct Car {
static_assert(
IsPair<Pair>::value,
"Pair type required"
);
typedef typename Pair::car type;
};
template <typename Pair>
struct Cdr {
static_assert(
IsPair<Pair>::value,
"Pair type required"
);
typedef typename Pair::cdr type;
};
}
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_
|