I have created a map like this : std::map<int, std::string> mapID;
INPUT: mapID[1] = "string!";
and I want to print element with the key is the 1. For example
cout << "The string is : " << mapID.at(1)->second << endl;
OR
cout << "The string is : " << mapID.find(1)->second << endl;
But I have the error
error: no matching function for call to ‘std::map >::at(std::string&)’
Aucun commentaire:
Enregistrer un commentaire