LeviLamina
Loading...
Searching...
No Matches
NewType.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5template <typename T0>
6struct NewType {
7public:
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
29namespace std {
30template <class T>
31class hash<NewType<T>> {
32public:
33 size_t operator()(NewType<T> const& t) const { return std::hash<T>{}(t.mValue); }
34};
35} // namespace std
STL namespace.
Definition NewType.h:6