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
[[nodiscard]]
NewType
() : mValue{} {}
11
12
[[nodiscard]]
NewType
(T0
const
& t) : mValue{t} {}
13
14
// not trivially copyable
15
[[nodiscard]]
NewType
(
NewType
const
& other) : mValue{other.mValue} {}
16
17
NewType
& operator=(
NewType
const
& other) {
18
mValue = other.mValue;
19
return
*
this
;
20
}
21
[[nodiscard]]
bool
operator==(
NewType
const
& other)
const
22
requires
(
requires
{ mValue == other.mValue; })
23
{
24
return
mValue == other.mValue;
25
}
26
[[nodiscard]]
bool
operator==(T0
const
& other)
const
27
requires
(
requires
{ mValue == other; })
28
{
29
return
mValue == other;
30
}
31
};
32
33
namespace
std
{
34
template
<
class
T>
35
class
hash<
NewType
<T>> {
36
public
:
37
size_t
operator()(
NewType<T>
const
& t)
const
{
return
std::hash<T>{}(t.mValue); }
38
};
39
}
// namespace std
std
STL namespace.
NewType
Definition
NewType.h:6
src
mc
util
NewType.h
Generated on Fri Jun 13 2025 05:04:55 for LeviLamina by
1.12.0