tess
0.4.0
Performance-first tile and path simulation substrate
Toggle main menu visibility
Loading...
Searching...
No Matches
tag_identity.h
1
#pragma once
2
3
#include <cstdint>
4
5
namespace
tess::detail {
6
7
// Runtime identity token for a compile-time tag or movement-class TYPE. Each
8
// instantiation owns one static byte, so the address is unique per type
9
// within a binary and stable for its lifetime — usable as a cache-key field
10
// or a graph/runtime stamp where the type itself cannot be stored. Zero is
11
// never returned, so 0 can mean "unbound".
12
template
<
typename
Tag>
13
[[nodiscard]]
inline
auto
tag_identity() noexcept -> std::uintptr_t {
14
static
const
auto
token = std::uint8_t{0};
15
return
reinterpret_cast<
std::uintptr_t
>
(&token);
16
}
17
18
}
// namespace tess::detail
include
tess
core
tag_identity.h
Generated by
1.17.0