mirror of
https://github.com/jslightham/cpp-utils.git
synced 2026-03-09 18:12:26 +01:00
Initial commit
This commit is contained in:
14
PairHash.h
Normal file
14
PairHash.h
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
#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
|
||||
Reference in New Issue
Block a user