Hello,
Surely I've missed something while reading the docs, but I cannot find the way to efficiently remove a range of elements from a BTreeMap
.
In C++, I would get an iterator to the first element to remove, and an iterator to the first element not to remove, and then call std::map::erase
, whose complexity is logarithmic in the number of elements in the map plus linear in number of elements to remove.
How would I proceed with BTreeMap
s with a similar complexity? I could split_off
the BTreeMap
at the beginning of my range, and a second time at the end of my range, and then append the original BtreeMap
to the one that was split off the second time, but this is both more complicated than map::erase(range_of_keys)
and also if I read correctly, linear in the number of remaining elements, rather than in the number of deleted ones?
Any help would be greatly appreciated. Thanks