Let's assume I have a map in my code:
map <string, set<string> > myMap;
... and I want to get an element from map:
myMap.find("key");
My question is: what kind of value will myMap return if "key" doesn't exist? `
///EDIT Can anyone point the reason of error? Compiler doesn't see any mistake but server which tests whole algorithm, doesn't accept it because of this function.
map< string, set<string> >::iterator mapIterator = container.find(key);
if(mapIterator != container.end()){
set<string>::iterator setIterator = mapIterator->second.begin();
if(!mapIterator->second.empty()){
while(setIterator != mapIterator->second.end()){
cout << *setIterator << endl;
++setIterator;
}
}else{
.......
}
}else{
..........
}