Skip to content

Instantly share code, notes, and snippets.

@hechen
Last active January 24, 2022 21:35
Show Gist options
  • Save hechen/f99df3d656a02f81ffc9eb63a076b896 to your computer and use it in GitHub Desktop.
Save hechen/f99df3d656a02f81ffc9eb63a076b896 to your computer and use it in GitHub Desktop.
struct PairHash {
template<class T1, class T2>
std::size_t operator()(std::pair<T1, T2> const & p) const noexcept {
std::size_t hash1 = std::hash<T1>{}(p.first);
std::size_t hash2 = std::hash<T2>{}(p.second);
return hash1 ^ (hash2 << 1);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment