Why std::map<Key,T,Compare,Allocator>::erase is amortized constant only for the single iterator overloading?

Viewed 17

In cppreference.com there are described the overloadings for std::map<Key,T,Compare,Allocator>::erase.

https://en.cppreference.com/w/cpp/container/map/erase

  1. void erase( iterator pos );
  2. void erase( iterator first, iterator last );

And then in the complexities for the previous two are:

Given an instance c of map:

  1. Amortized constant
  2. log(c.size()) + std::distance(first, last)

I understand the statement that the first overloading is amortized constant. My question is why the second is not and has the term log(c.size())?

0 Answers
Related