专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > 研发管理

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

发布时间:2011-06-18 12:18:37 文章来源:www.iduyao.cn 采编人员:星星草
map最好不要在使用的时候删除东西

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;
  }

友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: