LeviLamina
Loading...
Searching...
No Matches
NewType.h
1
#pragma once
2
3
#include "mc/_HeaderOutputPredefine.h"
4
5
template
<
typename
T0>
6
struct
NewType
{
7
public
:
8
T0 mValue;
9
10
// not trivially copyable
11
NewType
(
NewType
const
& other) : mValue{other.mValue} {}
12
13
NewType
& operator=(
NewType
const
& other) {
14
mValue = other.mValue;
15
return
*
this
;
16
}
17
[[nodiscard]]
inline
bool
operator==(
NewType
const
& other)
const
18
requires
(
requires
{ mValue == other.mValue; })
19
{
20
return
mValue == other.mValue;
21
}
22
[[nodiscard]]
inline
bool
operator==(T0
const
& other)
const
23
requires
(
requires
{ mValue == other; })
24
{
25
return
mValue == other;
26
}
27
};
28
29
namespace
std
{
30
template
<
class
T>
31
class
hash<
NewType
<T>> {
32
public
:
33
size_t
operator()(
NewType<T>
const
& t)
const
{
return
std::hash<T>{}(t.mValue); }
34
};
35
}
// namespace std
std
STL namespace.
NewType
Definition
NewType.h:6
src
mc
util
NewType.h
Generated on Sat Apr 26 2025 05:55:59 for LeviLamina by
1.12.0