aboutsummaryrefslogtreecommitdiff
path: root/src/common/Common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/Common.h')
-rw-r--r--src/common/Common.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common/Common.h b/src/common/Common.h
index 605b6dc4ae8..2a492e0eeee 100644
--- a/src/common/Common.h
+++ b/src/common/Common.h
@@ -45,6 +45,7 @@
#include <boost/optional.hpp>
#include <boost/utility/in_place_factory.hpp>
+#include <boost/functional/hash.hpp>
#include "Debugging/Errors.h"
@@ -178,4 +179,19 @@ namespace Trinity
}
}
+//! Hash implementation for std::pair to allow using pairs in unordered_set or as key for unordered_map
+//! Individual types used in pair must be hashable by boost::hash
+namespace std
+{
+ template<class K, class V>
+ struct hash<std::pair<K, V>>
+ {
+ public:
+ size_t operator()(std::pair<K, V> const& key) const
+ {
+ return boost::hash_value(key);
+ }
+ };
+}
+
#endif