LeviLamina
Loading...
Searching...
No Matches
AutomaticID.h
1
#pragma once
2
3
#include "mc/_HeaderOutputPredefine.h"
4
5
template
<
typename
A,
typename
T>
6
class
AutomaticID
{
7
public
:
8
T id;
9
10
using
Type = A;
11
12
[[nodiscard]]
constexpr
AutomaticID
() : id(0) {}
13
14
[[nodiscard]]
constexpr
AutomaticID
(T x) : id(x) {}
15
16
[[nodiscard]]
constexpr
operator
T()
const
{
return
id; }
17
18
[[nodiscard]]
inline
bool
operator==(
AutomaticID
const
& other)
const
{
return
id
== other.id; }
19
20
[[nodiscard]]
inline
bool
operator==(T
const
& other)
const
{
return
id
== other; }
21
22
[[nodiscard]]
inline
std::strong_ordering operator<=>(
AutomaticID
const
& other)
const
{
return
id <=> other.id; }
23
24
[[nodiscard]]
inline
std::strong_ordering operator<=>(T
const
& other)
const
{
return
id <=> other; }
25
};
26
27
namespace
std
{
28
template
<
typename
A,
typename
T>
29
class
hash<
AutomaticID
<A, T>> {
30
public
:
31
size_t
operator()(
AutomaticID<A, T>
const
& dimId)
const
{
return
static_cast<
size_t
>
(dimId.id); }
32
};
33
}
// namespace std
AutomaticID
Definition
AutomaticID.h:6
std
STL namespace.
src
mc
deps
core
utility
AutomaticID.h
Generated on Sat Apr 26 2025 05:55:26 for LeviLamina by
1.12.0