summaryrefslogtreecommitdiff
path: root/absl/container/btree_set.h
diff options
context:
space:
mode:
authorGravatar Evan Brown <ezb@google.com>2022-05-31 09:13:25 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-05-31 09:14:53 -0700
commitaeb2dc9c34e2dbddb5762d2ffca356e23eb55b56 (patch)
treeb1d86bd98dec391280ac7ce9109be0de99e201cf /absl/container/btree_set.h
parenta4cc270df18b47685e568e01bb5c825493f58d25 (diff)
Allow for using b-tree with `value_type`s that can only be constructed by the allocator (ignoring copy/move constructors).
We were using `init_type`s for temp values that we would move into slots, but in this case, we need to have actual slots. We use node handles for managing slots outside of nodes. Also, in btree::copy_or_move_values_in_order, pass the slots from the iterators rather than references to values. This allows for moving from map keys instead of copying for standard layout types. In the test, fix a couple of ClangTidy warnings from missing includes and calling `new` instead of `make_unique`. PiperOrigin-RevId: 452062967 Change-Id: I870e89ae1aa5b3cfa62ae6e75b73ffc3d52e731c
Diffstat (limited to 'absl/container/btree_set.h')
-rw-r--r--absl/container/btree_set.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/absl/container/btree_set.h b/absl/container/btree_set.h
index 7b6655ad..32a7c506 100644
--- a/absl/container/btree_set.h
+++ b/absl/container/btree_set.h
@@ -752,6 +752,11 @@ struct set_slot_policy {
}
template <typename Alloc>
+ static void construct(Alloc *alloc, slot_type *slot, const slot_type *other) {
+ absl::allocator_traits<Alloc>::construct(*alloc, slot, *other);
+ }
+
+ template <typename Alloc>
static void destroy(Alloc *alloc, slot_type *slot) {
absl::allocator_traits<Alloc>::destroy(*alloc, slot);
}