Flecs v4.1
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
entity_component_tuple.hpp
Go to the documentation of this file.
1
6#pragma once
7
13namespace flecs
14{
15
16 template<std::size_t size, typename... Args>
17 struct tuple_builder {};
18
19 // Size 2
20
21 template<typename T, typename U>
22 struct tuple_2 {
23 T val1; U val2;
24 };
25
26 template<typename... Args>
27 struct tuple_builder<2, Args...> {
28 using type = tuple_2<Args&...>;
29 using type_ptr = tuple_2<Args*...>;
30 using type_const = tuple_2<const Args&...>;
31 using type_const_ptr = tuple_2<const Args*...>;
32 };
33
34 // Size 3
35
36 template<typename T, typename U, typename V>
37 struct tuple_3 {
38 T val1; U val2; V val3;
39 };
40
41 template<typename... Args>
42 struct tuple_builder<3, Args...> {
43 using type = tuple_3<Args&...>;
44 using type_ptr = tuple_3<Args*...>;
45 using type_const = tuple_3<const Args&...>;
46 using type_const_ptr = tuple_3<const Args*...>;
47 };
48
49 // Size 4
50
51 template<typename T, typename U, typename V, typename W>
52 struct tuple_4 {
53 T val1; U val2; V val3; W val4;
54 };
55
56 template<typename... Args>
57 struct tuple_builder<4, Args...> {
58 using type = tuple_4<Args&...>;
59 using type_ptr = tuple_4<Args*...>;
60 using type_const = tuple_4<const Args&...>;
61 using type_const_ptr = tuple_4<const Args*...>;
62 };
63
64 // Size 5
65
66 template<typename T, typename U, typename V, typename W, typename X>
67 struct tuple_5 {
68 T val1; U val2; V val3; W val4; X val5;
69 };
70
71 template<typename... Args>
72 struct tuple_builder<5, Args...> {
73 using type = tuple_5<Args&...>;
74 using type_ptr = tuple_5<Args*...>;
75 using type_const = tuple_5<const Args&...>;
76 using type_const_ptr = tuple_5<const Args*...>;
77 };
78
79 // Size 6
80
81 template<typename T, typename U, typename V, typename W, typename X, typename Y>
82 struct tuple_6 {
83 T val1; U val2; V val3; W val4; X val5; Y val6;
84 };
85
86 template<typename... Args>
87 struct tuple_builder<6, Args...> {
88 using type = tuple_6<Args&...>;
89 using type_ptr = tuple_6<Args*...>;
90 using type_const = tuple_6<const Args&...>;
91 using type_const_ptr = tuple_6<const Args*...>;
92 };
93
94 // Size 7
95
96 template<typename T, typename U, typename V, typename W, typename X, typename Y, typename Z>
97 struct tuple_7 {
98 T val1; U val2; V val3; W val4; X val5; Y val6; Z val7;
99 };
100
101 template<typename... Args>
102 struct tuple_builder<7, Args...> {
103 using type = tuple_7<Args&...>;
104 using type_ptr = tuple_7<Args*...>;
105 using type_const = tuple_7<const Args&...>;
106 using type_const_ptr = tuple_7<const Args*...>;
107 };
108
109 // Size 8
110
111 template<typename T, typename U, typename V, typename W, typename X, typename Y, typename Z, typename A>
112 struct tuple_8 {
113 T val1; U val2; V val3; W val4; X val5; Y val6; Z val7; A val8;
114 };
115
116 template<typename... Args>
117 struct tuple_builder<8, Args...> {
118 using type = tuple_8<Args&...>;
119 using type_ptr = tuple_8<Args*...>;
120 using type_const = tuple_8<const Args&...>;
121 using type_const_ptr = tuple_8<const Args*...>;
122 };
123
124}
125