Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace std {
- enum hash_traits_result {
- always_true,
- always_false,
- runtime
- };
- template<typename T> struct hash_traits {
- template<typename A, typename B> struct heterogenous {
- static constexpr hash_traits_result result = always_false;
- };
- };
- template<> struct hash_traits<std::hash<>> {
- template<typename A, typename B> struct heterogenous;
- };
- template<typename T> struct hash_traits<std::hash<>>::heterogenous<std::unique_ptr<T>, T*> {
- static constexpr hash_traits_result result = always_true;
- };
- }
- struct mah_hasher {
- bool do_the_right_thing;
- };
- template<> struct hash_traits<mah_hasher>::heterogenous<X, Y> {
- static constexpr hash_traits_result result = runtime;
- bool operator()(const mah_hasher& ref) {
- return ref.do_the_right_thing;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement