mercredi 27 janvier 2016

how the map container M.end() work in this code ? is it return the last vaue of map

map < string , int > M;

M["Top"] = 1;

M["Coder"] = 2;

M["SRM"] = 10;

int x = M["Top"] + M["Coder"];

if(M.find("SRM") != M.end()) {

  M.erase(M.find("SRM")); // or even M.erase("SRM") 

}

Aucun commentaire:

Enregistrer un commentaire