summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Evan Brown <ezb@google.com>2023-09-01 07:57:39 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-09-01 07:58:46 -0700
commitfc44fa053cc91193d2bb60fb9356bcecb301242e (patch)
tree22fce051a60e5e47dd173b9110e69847a6843906
parenta4b11563f9c3706339209526cbd3b819fca773e8 (diff)
Add a comment about a more efficient implementation of btree range erase.
PiperOrigin-RevId: 561954737 Change-Id: I0e29a4f4523e4b3eafbd26d1d96f6e1c8deed957
-rw-r--r--absl/container/internal/btree.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/absl/container/internal/btree.h b/absl/container/internal/btree.h
index 569faa07..5e8a2523 100644
--- a/absl/container/internal/btree.h
+++ b/absl/container/internal/btree.h
@@ -2534,6 +2534,10 @@ auto btree<P>::rebalance_after_delete(iterator iter) -> iterator {
return res;
}
+// Note: we tried implementing this more efficiently by erasing all of the
+// elements in [begin, end) at once and then doing rebalancing once at the end
+// (rather than interleaving deletion and rebalancing), but that adds a lot of
+// complexity, which seems to outweigh the performance win.
template <typename P>
auto btree<P>::erase_range(iterator begin, iterator end)
-> std::pair<size_type, iterator> {