Last active
November 29, 2016 12:47
-
-
Save geneotech/b76ad0568eb7c3e86b5fee59df6c1f6d 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
#include <unordered_map> | |
namespace std { | |
template <class T> | |
struct member_hash { | |
std::size_t operator()(const T& t) const { | |
return t.hash(); | |
} | |
}; | |
template <class Key, class Value> | |
using unordered_map_member_hash = std::unordered_map<Key, Value, member_hash<Key>>; | |
} | |
struct Vertex { | |
std::size_t hash() const { | |
return 1337; | |
} | |
}; | |
struct Dupa { | |
}; | |
int main() { | |
std::unordered_map_member_hash<Vertex, Dupa> m; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment