使用迭代器删除 其中的一个
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++;
}
}