您的位置:首页 > 其它

map最好不要在使用的时候删除东西

2012-06-21 16:42 381 查看
typedef map<int, int> templatemap;

templatemap AllScoreSort;

for(int i=10000;i<10010;i++)

AllScoreSort[i]=i+1;

for (templatemap::iterator iter = AllScoreSort.begin(); iter!= AllScoreSort.end(); iter++)

{

int nRoleID = iter->first;

int nScore = iter->second;

if (10005 < nRoleID)

{

//AllScoreSort.erase(nRoleID); //注意这行

continue;

}

cout<<nRoleID<<" "<<nScore<<endl;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐