How does overloading of const and non-const functions work?

In the example you gave:

vector<int>::const_iterator it = myvector.begin();

if myvector isn’t const the non-const version of begin() will be called and you will be relying on an implicit conversion from iterator to const_iterator.

Leave a Comment