使用迭代器删除 其中的一个

for (CXMLWrapperUserObj::VEC_USEROBJS::iterator itor = pVecAll.begin(); itor != pVecAll.end(); )  

{   CXMLWrapperUserObj *pSingleFlowerUserObj = *itor;

  DressUpgradeConfigModel *pModel = new DressUpgradeConfigModel;   

pModel->FieldFromUserConfig(pSingleFlowerUserObj);

  int nDressID = pModel->getDressUpgradeID();   

CDressItemModel *pDressItemModel = CDressItemModel::GetDressItemModelByID(nDressID);  

 if (NULL == pDressItemModel)   

{   

 continue;  

 }

  string strDressSex = pDressItemModel->GetSex();   //0-女  1-男   

 if (m_strRoleSex != strDressSex)  

 {   

 itor = pVecAll.erase(itor);  

 }  

 else  

 {   

 itor++;

  }  

}

posted @ 2015-04-09 09:29  一个橙子~  阅读(276)  评论(0编辑  收藏  举报