Created
December 14, 2022 04:47
-
-
Save hechen/db2c60c413dad45146711da8a5860efd 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
// std::hash<std::vector<int>> | |
struct VectorHash { template<class T> | |
std::size_t operator()(vector<T> const &vec) const noexcept { | |
std::size_t ans = 0; | |
for (const auto& v: vec) { | |
ans ^= std::hash<T>{}(n) + (ans << 6) + 0x9e3779b9 + (ans >> 2); | |
} | |
return ans; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment