Cppreference only says:
Removes specified elements from the container. 1) Removes the element at pos. 2) Removes the elements in the range [first; last).
Invalidates iterators and references at or after the point of the erase, including the end() iterator.
The iterator pos must be valid and dereferenceable. Thus the end() iterator (which is valid, but is not dereferencable) cannot be used as a value for pos.
The iterator first does not need to be dereferenceable if first==last: erasing an empty range is a no-op.
Not necessarily no. When reading the C++ standard (and cppreference proxies the standard remarkably well), if something is not explicitly mentioned, then assume such a something is not required.
It would possibly be sub-optimal for a C++ Standard Library implementation to do so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With