Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename T>
- void hash_combine(std::size_t& seed, const T& v)
- {
- std::hash<T> hasher;
- seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
- }
- namespace std
- {
- template<>
- struct hash<KeyType>
- {
- size_t operator() (const KeyType& kt)
- {
- size_t seed = 0;
- hash_combine(seed, kt.x);
- hash_combine(seed, kt.y);
- hash_combine(seed, kt.z);
- return seed;
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment