map erase issue
Suppose there is a map (key:integer, value: object) which is not empty as below,
I want to know if the object is still available after erase?
mymap = "sssss";
map<int,string>::iterator itr = mymap.find(0);
string& s = itr->second;
//or string* s = &(itr->second);
printf("RRR %s\n", s.c_str());
Last edited on
No it's not still available, so your call to s.c_str() results in undefined behavior.
Topic archived. No new replies allowed.