How to update the value of a key in std::map after using the find method?
std::map
find
I have a map and iterator declaration like this:
You can use std::map::at member function, it returns a reference to the mapped value of the element identified with key k.
std::map::at
std::map mymap = { { 'a', 0 }, { 'b', 0 }, }; mymap.at('a') = 10; mymap.at('b') = 20;