mirror of
https://github.com/jslightham/cpp-utils.git
synced 2026-03-09 18:12:26 +01:00
15 lines
311 B
C++
15 lines
311 B
C++
|
|
#ifndef PAIRHASH_H
|
|
#define PAIRHASH_H
|
|
|
|
#include <unordered_map>
|
|
|
|
// Custom hash function for std::pair
|
|
template <typename T> struct pair_hash {
|
|
std::size_t operator()(const std::pair<T, T> &p) const {
|
|
return std::hash<T>()(p.first) ^ (std::hash<T>()(p.second) << 1);
|
|
}
|
|
};
|
|
|
|
#endif // PAIRHASH_H
|