Created
December 15, 2024 09:24
-
-
Save maidis/ee4ac7da6940232dcd6707401156b787 to your computer and use it in GitHub Desktop.
std::unordered_set<std::pair<int, int>>
This file contains hidden or 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_set> | |
namespace std { | |
template<typename X, typename Y> | |
struct hash<std::pair<X, Y>> { | |
std::size_t operator()(const std::pair<X, Y> &pair) const { | |
return std::hash<X>()(pair.first) ^ std::hash<Y>()(pair.second); | |
} | |
}; | |
} | |
int main(void) { | |
std::unordered_set<std::pair<int, int>> test; | |
} |
This file contains hidden or 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_set> | |
int main(void) { | |
std::unordered_set<std::pair<int, int>> test; | |
} |
This file contains hidden or 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
namespace std { | |
template<typename X, typename Y> | |
struct hash<std::pair<X, Y>> { | |
std::size_t operator()(const std::pair<X, Y> &pair) const { | |
return std::hash<X>()(pair.first) ^ std::hash<Y>()(pair.second); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment