Shkyera Engine
Easy to use, game engine for Python
Loading...
Searching...
No Matches
TypeInfo.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <set>
4#include <string_view>
5
6namespace shkyera {
7
9
10template <typename T>
11constexpr uint64_t getId() {
12 constexpr std::string_view name = __PRETTY_FUNCTION__;
13 uint64_t hash = 0xcbf29ce484222325;
14 for (char c : name) {
15 hash ^= static_cast<uint64_t>(c);
16 hash *= 0x100000001b3;
17 }
18 return hash;
19}
20
21template <typename T>
22struct TypeInfo {
23 TypeInfo() = delete;
24
25 inline static constexpr TypeID ID = getId<T>();
26};
27
28using TypeSet = std::set<TypeID>;
29
30} // namespace shkyera
Definition Asset.hpp:6
constexpr uint64_t getId()
Definition TypeInfo.hpp:11
uint64_t TypeID
Definition TypeInfo.hpp:8
std::set< TypeID > TypeSet
Definition TypeInfo.hpp:28
Definition Clock.hpp:9
Definition TypeInfo.hpp:22
static constexpr TypeID ID
Definition TypeInfo.hpp:25