aboutsummaryrefslogtreecommitdiff
path: root/src/list/cons.h
blob: 8efca67be7d8352c4dde209a9aca99351316b4cf (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
#ifndef TYPEASVALUE_SRC_LIST_CONS_H_
#define TYPEASVALUE_SRC_LIST_CONS_H_

#include "pair.h"

namespace tav {

template <
	typename CAR,
	typename CDR
>
struct Cons {
	typedef Pair<CAR, CDR> type;
};

template <typename Pair>
struct Car {
	static_assert(
		Eval<IsPair<Pair>>::value,
		"Pair type required"
	);

	typedef typename Pair::car type;
};

template <typename Pair>
struct Cdr {
	static_assert(
		Eval<IsPair<Pair>>::value,
		"Pair type required"
	);

	typedef typename Pair::cdr type;
};

}

#endif  // TYPEASVALUE_SRC_LIST_CONS_H_