blob: cee4cbc65745869be4f7bf24572678620facb468 (
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_OPERATION_BASIC_H_
#define TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_
#include "operation/math.h"
namespace tav {
template <typename Cons>
struct Length {
typedef Add<
Size<1>,
typename Length<Tail<Cons>
>::type> type;
};
template <>
struct Length<void> {
typedef Size<0> type;
};
template <
typename Index,
typename Cons
>
struct Nth {
typedef If<
equal_value<Index, Size<0>>::value,
Head<Cons>,
typename Nth<Substract<Index, Size<1>>, Tail<Cons>>::type
> type;
};
template <typename Index>
struct Nth<Index, void> {
typedef void type;
};
}
#endif // TYPEASVALUE_SRC_LIST_OPERATION_BASIC_H_
|