about summary refs log tree commit diff
path: root/absl/hash/internal/hash.h
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2020-05-15T15·23-0700
committerAndy Getz <durandal@google.com>2020-05-15T21·57-0400
commit62cf6a70414e15b356ec4f712ca8758133674f28 (patch)
treed517fe8c1bb80458f8dda3e7b77ff7f32cf436d8 /absl/hash/internal/hash.h
parentd118d4bb115387cc52c5338221f2554a940e6d90 (diff)
Export of internal Abseil changes
--
dc36565216b3022abb5a3c92f46fb4079bda869e by Samuel Benzaquen <sbenza@google.com>:

Add support for std::reference_wrapper to absl::Hash.

PiperOrigin-RevId: 311733171
GitOrigin-RevId: dc36565216b3022abb5a3c92f46fb4079bda869e
Change-Id: I74543390446c2b7f6d856935aa36f28539810eef
Diffstat (limited to 'absl/hash/internal/hash.h')
-rw-r--r--absl/hash/internal/hash.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h
index a71bd4a65df8..9e608f7c3c29 100644
--- a/absl/hash/internal/hash.h
+++ b/absl/hash/internal/hash.h
@@ -551,6 +551,13 @@ typename std::enable_if<is_hashable<Key>::value, H>::type AbslHashValue(
 // AbslHashValue for Wrapper Types
 // -----------------------------------------------------------------------------
 
+// AbslHashValue for hashing std::reference_wrapper
+template <typename H, typename T>
+typename std::enable_if<is_hashable<T>::value, H>::type AbslHashValue(
+    H hash_state, std::reference_wrapper<T> opt) {
+  return H::combine(std::move(hash_state), opt.get());
+}
+
 // AbslHashValue for hashing absl::optional
 template <typename H, typename T>
 typename std::enable_if<is_hashable<T>::value, H>::type AbslHashValue(