c++ - how does overloading of const and non-const functions work? -


the stl full of definitions this:

iterator begin (); const_iterator begin () const; 

as return value not participate in overloading resolution, difference here function being const. part of overloading mechanism? compiler's algorithm resolving line like:

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

in example gave:

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

if myvector isn't const non-const version of begin() called , relying on implicit conversion iterator const_iterator.


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -