I am just curious to know if I can change/update the map's value using const_iterator.
Below is the code snippet:
int main()
{
map <int, int> m;
m.insert(make_pair(1, 10));
map <int, int>::const_iterator itr = m.begin(); //The iterator is const_iterator
itr->second = 30;
cout << itr->second; //The value to be printed is 30, and not 10.
return 0;
}
Thank you in advance for sharing your ideas.