首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件开发 >

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

2012-06-22 
map最好不要在使用的时候删除东西typedef mapint, int templatemaptemplatemap AllScoreSortfor(int i

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

热点排行