EntityComponentMetaSystem
An implementation of an EntityComponent System with template meta-programming.
Loading...
Searching...
No Matches
src
EC
Meta
TypeListGet.hpp
1
2
// This work derives from Vittorio Romeo's code used for cppcon 2015 licensed
3
// under the Academic Free License.
4
// His code is available here: https://github.com/SuperV1234/cppcon2015
5
6
7
#ifndef EC_META_TYPE_LIST_GET_HPP
8
#define EC_META_TYPE_LIST_GET_HPP
9
10
#include <type_traits>
11
12
#include "TypeList.hpp"
13
#include "IndexOf.hpp"
14
15
namespace
EC
16
{
17
namespace
Meta
18
{
19
template
<
typename
TTypeList,
typename
TTTypeList,
unsigned
int
Index>
20
struct
TypeListGetHelper
21
{
22
using
type = TTypeList;
23
};
24
25
template
<
26
typename
TTypeList,
27
template
<
typename
...>
class
TTTypeList,
28
unsigned
int
Index,
29
typename
Type,
30
typename
... Rest>
31
struct
TypeListGetHelper
<TTypeList, TTTypeList<Type, Rest...>, Index>
32
{
33
using
type =
34
typename
std::conditional<
35
Index ==
EC::Meta::IndexOf<Type, TTypeList>::value
,
36
Type,
37
typename
TypeListGetHelper
<
38
TTypeList, TTTypeList<Rest...>, Index>::type
39
>::type;
40
};
41
42
template
<
typename
TTypeList,
unsigned
int
Index>
43
using
TypeListGet =
44
typename
TypeListGetHelper<TTypeList, TTypeList, Index>::type;
45
}
46
}
47
48
#endif
49
EC::Meta::IndexOf
Definition
IndexOf.hpp:24
EC::Meta::TypeListGetHelper
Definition
TypeListGet.hpp:21
Generated by
1.9.8