diff options
author | Evan Brown <ezb@google.com> | 2022-11-15 11:59:12 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-11-15 12:00:00 -0800 |
commit | 7c022b94f78f0ae196a9d99a3c552c996dbcbbaf (patch) | |
tree | a595699e2f0433f8c6a54e0000ea83a9ca90ff4a /LICENSE | |
parent | 842560d214649fc0077838e5b02cc35e4af12526 (diff) |
Add a new API for `extract_and_get_next()` in b-tree that returns both the extracted node and an iterator to the next element in the container.
Motivation: it can be useful, when calling `extract` to maintain an iterator next to the location of the extracted element. `std::set`, et al. allow for this because they have iterator stability. `absl::{flat,node}_hash_{set,map}` allow for this because they are guaranteed not to rehash when elements are removed so they also have iterator stability across calls to `extract()`. But b-tree doesn't support this use case without this API because removing elements can cause rebalancing, which invalidates iterators. We can get the next iterator without this API using `lower_bound(node_handle.value())`, but that requires an extra lookup.
PiperOrigin-RevId: 488721247
Change-Id: Id66f17311bf53678f536e4e4f070775f5ce0c542
Diffstat (limited to 'LICENSE')
0 files changed, 0 insertions, 0 deletions