summaryrefslogtreecommitdiff
path: root/absl/container/internal/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/container/internal/common.h')
-rw-r--r--absl/container/internal/common.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/absl/container/internal/common.h b/absl/container/internal/common.h
index 8990f294..030e9d4a 100644
--- a/absl/container/internal/common.h
+++ b/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 {