aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-10-25 11:38:38 +0100
committerShauren <shauren.trinity@gmail.com>2015-10-31 20:26:40 +0100
commit31586056034fe730a7a89ddc7200e9087a9440aa (patch)
treee42936ae1ed2eb3697c17627506a272230505eb9 /src/common
parentdc74454356af726c96c83b02418d46bc664cee8e (diff)
Core/Conditions: Optimizations part 1 - use containers more suited for their role
(cherry picked from commit 9fa938f3e0df2ca6b9ff4f800a5b41ba18cdd214)
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Common.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/common/Common.h b/src/common/Common.h
index 908cd487822..7a1ea247a94 100644
--- a/src/common/Common.h
+++ b/src/common/Common.h
@@ -161,4 +161,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