SDEngine
Game Engine
Loading...
Searching...
No Matches
type_id.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "types.hpp"
4
5template<typename T>
6consteval U64 type_id_of() {
7 constexpr std::string_view name = __PRETTY_FUNCTION__;
8 U64 hash = 14695981039346656037ULL;
9 for (USize i = 0; i < name.size(); ++i) {
10 hash ^= static_cast<U8>(name[i]);
11 hash *= 1099511628211ULL;
12 }
13 return hash;
14}
consteval U64 type_id_of()
Definition type_id.hpp:6
std::size_t USize
Definition types.hpp:18
std::uint64_t U64
Definition types.hpp:16
std::uint8_t U8
Definition types.hpp:13