about summary refs log tree commit diff
path: root/third_party/abseil_cpp/absl/container/internal/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/abseil_cpp/absl/container/internal/common.h')
-rw-r--r--third_party/abseil_cpp/absl/container/internal/common.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/third_party/abseil_cpp/absl/container/internal/common.h b/third_party/abseil_cpp/absl/container/internal/common.h
index 8990f2947273..030e9d4ab07d 100644
--- a/third_party/abseil_cpp/absl/container/internal/common.h
+++ b/third_party/abseil_cpp/absl/container/internal/common.h
@@ -146,8 +146,11 @@ class node_handle<Policy, PolicyTraits, Alloc,
 
   constexpr node_handle() {}
 
-  auto key() const -> decltype(PolicyTraits::key(std::declval<slot_type*>())) {
-    return PolicyTraits::key(this->slot());
+  // When C++17 is available, we can use std::launder to provide mutable
+  // access to the key. Otherwise, we provide const access.
+  auto key() const
+      -> decltype(PolicyTraits::mutable_key(std::declval<slot_type*>())) {
+    return PolicyTraits::mutable_key(this->slot());
   }
 
   mapped_type& mapped() const {