First question: is it possible to "force" a const_iterator
using auto?
For example:
map<int> usa;
//...init usa
auto city_it = usa.find("New York");
I just want to query, instead of changing anything pointed by city_it
, so I'd like to have city_it
to be map<int>::const_iterator
. But by using auto, city_it
is the same to the return type of map::find()
, which is map<int>::iterator
. Any suggestion?