summaryrefslogtreecommitdiff
path: root/absl/container/flat_hash_map.h
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2024-01-30 12:52:43 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2024-01-30 12:53:38 -0800
commitc44dd5acd7848a175d1fb939cdb81a4cf8d4c912 (patch)
tree4f853927f1aa61dc3fd658dbba141f6d9148b1db /absl/container/flat_hash_map.h
parent779a3565ac6c5b69dd1ab9183e500a27633117d5 (diff)
Early return from destroy_slots for trivially destructible types in flat_hash_{*}.
PiperOrigin-RevId: 602813933 Change-Id: I744fe438281755a141b2fd47e54ab9c6c0fad5a3
Diffstat (limited to 'absl/container/flat_hash_map.h')
-rw-r--r--absl/container/flat_hash_map.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/absl/container/flat_hash_map.h b/absl/container/flat_hash_map.h
index acd013b0..808a62ba 100644
--- a/absl/container/flat_hash_map.h
+++ b/absl/container/flat_hash_map.h
@@ -573,9 +573,10 @@ struct FlatHashMapPolicy {
slot_policy::construct(alloc, slot, std::forward<Args>(args)...);
}
+ // Returns std::true_type in case destroy is trivial.
template <class Allocator>
- static void destroy(Allocator* alloc, slot_type* slot) {
- slot_policy::destroy(alloc, slot);
+ static auto destroy(Allocator* alloc, slot_type* slot) {
+ return slot_policy::destroy(alloc, slot);
}
template <class Allocator>