diff options
author | Evan Brown <ezb@google.com> | 2023-09-15 11:22:53 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-09-15 11:23:57 -0700 |
commit | f44e2cac7b8b20e1a6f5457714003e6d7022e889 (patch) | |
tree | 284540883ac6f7d63540a1a3d564c7051d2c30a1 | |
parent | 49be2e68de5b063bce5d0757078c62906a2674ea (diff) | |
download | abseil-f44e2cac7b8b20e1a6f5457714003e6d7022e889.tar.gz abseil-f44e2cac7b8b20e1a6f5457714003e6d7022e889.tar.bz2 abseil-f44e2cac7b8b20e1a6f5457714003e6d7022e889.zip |
Fix a bug in which we used propagate_on_container_copy_assignment in btree move assignment.
PiperOrigin-RevId: 565730754
Change-Id: Id828847d32c812736669803c179351433dda4aa6
-rw-r--r-- | absl/container/btree_test.cc | 6 | ||||
-rw-r--r-- | absl/container/internal/btree.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/absl/container/btree_test.cc b/absl/container/btree_test.cc index 3e239c50..1f4e368d 100644 --- a/absl/container/btree_test.cc +++ b/absl/container/btree_test.cc @@ -2515,14 +2515,14 @@ TEST(Btree, MoveAssignmentAllocatorPropagation) { InstanceTracker tracker; int64_t bytes1 = 0, bytes2 = 0; - PropagatingCountingAlloc<MovableOnlyInstance> allocator1(&bytes1); - PropagatingCountingAlloc<MovableOnlyInstance> allocator2(&bytes2); + MoveAssignPropagatingCountingAlloc<MovableOnlyInstance> allocator1(&bytes1); + MoveAssignPropagatingCountingAlloc<MovableOnlyInstance> allocator2(&bytes2); std::less<MovableOnlyInstance> cmp; // Test propagating allocator_type. { absl::btree_set<MovableOnlyInstance, std::less<MovableOnlyInstance>, - PropagatingCountingAlloc<MovableOnlyInstance>> + MoveAssignPropagatingCountingAlloc<MovableOnlyInstance>> set1(cmp, allocator1), set2(cmp, allocator2); for (int i = 0; i < 100; ++i) set1.insert(MovableOnlyInstance(i)); diff --git a/absl/container/internal/btree.h b/absl/container/internal/btree.h index 419a5356..ef630aea 100644 --- a/absl/container/internal/btree.h +++ b/absl/container/internal/btree.h @@ -2423,7 +2423,7 @@ auto btree<P>::operator=(btree &&other) noexcept -> btree & { using std::swap; if (absl::allocator_traits< - allocator_type>::propagate_on_container_copy_assignment::value) { + allocator_type>::propagate_on_container_move_assignment::value) { swap(root_, other.root_); // Note: `rightmost_` also contains the allocator and the key comparator. swap(rightmost_, other.rightmost_); |