diff --git a/absl/container/internal/btree.h b/absl/container/internal/btree.h index e559bece..203823b0 100644 --- a/absl/container/internal/btree.h +++ b/absl/container/internal/btree.h @@ -1335,7 +1335,7 @@ class btree { btree(btree &&other) noexcept : root_(absl::exchange(other.root_, EmptyNode())), rightmost_(std::move(other.rightmost_)), - size_(absl::exchange(other.size_, 0)) { + size_(absl::exchange(other.size_, 0u)) { other.mutable_rightmost() = EmptyNode(); } btree(btree &&other, const allocator_type &alloc) @@ -1761,11 +1761,11 @@ inline void btree_node
::remove_values(const field_type i, if (is_internal()) { // Delete all children between begin and end. - for (int j = 0; j < to_erase; ++j) { + for (field_type j = 0; j < to_erase; ++j) { clear_and_delete(child(i + j + 1), alloc); } // Rotate children after end into new positions. - for (int j = i + to_erase + 1; j <= orig_finish; ++j) { + for (field_type j = i + to_erase + 1; j <= orig_finish; ++j) { set_child(j - to_erase, child(j)); clear_child(j); } @@ -1912,7 +1912,8 @@ void btree_node
::merge(btree_node *src, allocator_type *alloc) { if (is_internal()) { // Move the child pointers from the right to the left node. - for (int i = src->start(), j = finish() + 1; i <= src->finish(); ++i, ++j) { + for (field_type i = src->start(), j = finish() + 1; i <= src->finish(); + ++i, ++j) { init_child(j, src->child(i)); src->clear_child(i); } @@ -2301,7 +2302,8 @@ auto btree
::operator=(btree &&other) noexcept -> btree & {
template ::erase(iterator iter) -> iterator {
- iter.node_->value_destroy(iter.position_, mutable_allocator());
+ iter.node_->value_destroy(static_cast ::erase(iterator iter) -> iterator {
iterator internal_iter(iter);
--iter;
assert(iter.node_->is_leaf());
- internal_iter.node_->transfer(internal_iter.position_, iter.position_,
- iter.node_, mutable_allocator());
+ internal_iter.node_->transfer(
+ static_cast ::rebalance_after_delete(iterator iter) -> iterator {
template ::erase_range(iterator begin, iterator end)
-> std::pair ::erase_range(iterator begin, iterator end)
if (begin.node_ == end.node_) {
assert(end.position_ > begin.position_);
- begin.node_->remove_values(begin.position_, end.position_ - begin.position_,
- mutable_allocator());
+ begin.node_->remove_values(
+ static_cast ::erase_range(iterator begin, iterator end)
if (begin.node_->is_leaf()) {
const size_type remaining_to_erase = size_ - target_size;
const size_type remaining_in_node =
- begin.node_->finish() - begin.position_;
- const size_type to_erase =
- (std::min)(remaining_to_erase, remaining_in_node);
- begin.node_->remove_values(begin.position_, to_erase,
- mutable_allocator());
+ static_cast