lundi 30 mars 2020

Can i change the value of std map without finding it first

This is how currently i am changing the value of std::map

std::map<std::string, int> stdmapMasks;
stdmapMasks.insert(std::make_pair("VALUE", 1));
std::map<char, int>::iterator it = stdmapMasks.find('VALUE'); 
if (it != stdmapMasks.end())
    it->second = 42;

Can i change the value directly without the need to find the map element ?

Aucun commentaire:

Enregistrer un commentaire