Created
September 6, 2023 15:18
-
-
Save pookjw/9a4ad597a8bef279df016f658af58378 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <concepts> | |
#import <functional> | |
template<class _Tp> | |
concept hashable = requires { | |
std::hash<_Tp>(); | |
}; | |
template <class T> requires std::equality_comparable<T> && std::copyable<T> && hashable<T> | |
class IdentifiableRef { | |
public: | |
IdentifiableRef(const T value) : value(value) {}; | |
IdentifiableRef(const IdentifiableRef &other) { | |
this->value == other.value; | |
} | |
IdentifiableRef& operator=(const IdentifiableRef &other) { | |
this->value = other.value; | |
} | |
bool operator==(const IdentifiableRef& other) const { | |
return this->value == other.value; | |
} | |
const T value; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment