summaryrefslogtreecommitdiff
path: root/src/support/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/support/hash.h')
-rw-r--r--src/support/hash.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/support/hash.h b/src/support/hash.h
index 1af462b7e..d3a858698 100644
--- a/src/support/hash.h
+++ b/src/support/hash.h
@@ -50,4 +50,17 @@ template<typename T> inline void rehash(std::size_t& digest, const T& value) {
} // namespace wasm
+namespace std {
+
+// Hashing pairs is often useful
+template<typename T1, typename T2> struct hash<pair<T1, T2>> {
+ size_t operator()(const pair<T1, T2>& p) const {
+ auto digest = wasm::hash(p.first);
+ wasm::rehash(digest, p.second);
+ return digest;
+ }
+};
+
+} // namespace std
+
#endif // wasm_support_hash_h