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

posted @ 2012-06-21 16:42  byfei  阅读(180)  评论(0编辑  收藏  举报