what is the difference between const_iterator and iterator? [duplicate]
There is no performance difference. A const_iterator is an iterator that points to const value (like a const T* pointer); dereferencing it returns a reference to a constant value (const T&) and prevents modification of the referenced value: it enforces const-correctness. When you have a const reference to the container, you can only get a … Read more