VOX
A little voxel engine
Loading...
Searching...
No Matches
ecs_utils.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <concepts>
4#include <functional>
5#include <tuple>
6#include "ecs_CONSTANTS.hpp"
7
8namespace ecs
9{
10 template <typename I>
11 concept ValidEntity = std::integral<I> && std::unsigned_integral<I>;
12
13 template <typename T, typename... Ts>
14 concept is_any = std::disjunction_v<std::is_same<T, Ts>...>;
15
16 template <typename... Args>
17 struct IndexOf
18 {
19 template <typename T> requires is_any<T, Args...>
20 static size_t get()
21 {
22 static size_t local_index = index++;
23
24 return local_index;
25 }
26 private:
27 static size_t index;
28 };
29
30 template <typename... Args>
31 size_t IndexOf<Args...>::index = 0;
32}
Definition: ecs_utils.hpp:11
Definition: ecs_utils.hpp:14
Definition: ComponentStorage.hpp:9
Definition: ecs_utils.hpp:18
static size_t get()
Definition: ecs_utils.hpp:20