【发布时间】:2016-02-22 08:14:49
【问题描述】:
我希望能够删除一个元素,但我不知道我缺少什么。程序崩溃。
void Movies::removePeliculaAlies(short unsigned year,string title){
map<string,map<unsigned short, string> >::iterator itAlies=_mapaAlies.begin();
while(itAlies!=_mapaAlies.end()){
map<unsigned short,string>::iterator itInterior;
itInterior=itAlies->second.find(year);
if(itInterior!=itAlies->second.end()){
if(title==itInterior->second){
itAlies->second.erase(itInterior);->>>>>>>>>>>>>NOT WORKING WHY?
}
if(itAlies->second.size()==0) _mapaAlies.erase(itAlies->first);
}
itAlies++;
}
}
【问题讨论】:
-
你说,“为什么不工作?” ......但它有什么作用?它什么都不做吗?它会崩溃吗?
-
是的程序崩溃了
-
或许你可以试试调试它?
标签: c++ dictionary nested erase