Given
std::map<int,std::string> myMap;
fillMyMapWithStuff(myMap);
// modify key values - I need to add a constant value to each key
for (std::map<int,std::string>::iterator mi=myMap.begin(); mi != myMap.end(); ++mi)
{
// ...
}
Whats a good way apply some re-indexing? Must I remove the old entry and add a new one with the new key and old value?
See Question&Answers more detail:os