aboutsummaryrefslogtreecommitdiff
path: root/src/list/generator/make_list.h
blob: 863dce2a6c48b6a5ace678adf8c2a335dbe8bcbe (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
#ifndef TYPEASVALUE_SRC_LIST_GENERATOR_MAKE_LIST_H_
#define TYPEASVALUE_SRC_LIST_GENERATOR_MAKE_LIST_H_

#include "list/cons.h"
#include "operation/math.h"

namespace tav {

namespace detail {

template <
	typename Count,
	typename Element
>
struct MakeList {
	typedef Cons<
		Element,
		Eval<MakeList<
			Substract<Count, Size<1>>,
			Element
		>>
	> type;
};

template <typename Element>
struct MakeList<Size<1>, Element> {
	typedef Cons<Element, void> type;
};

}

template <
	typename Count,
	typename Element
>
using MakeList = Eval<detail::MakeList<Count, Element>>;

}

#endif  // TYPEASVALUE_SRC_LIST_GENERATOR_MAKE_LIST_H_