According to e.g. https://en.cppreference.com/w/cpp/container/vector/erase the parameters to std::vector::erase
were in C++11 changed from iterator
to const_iterator
.
This is surprising; logically, the container does have to change the data pointed to by those iterators, and indeed when I implemented my own vector class, the compiler complained that I was calling memmove
with a const pointer; I fixed it by changing the parameters back to iterator
.
What's the logic behind making them const_iterator
?