std::map<std::string, std::string > mapTest;
bool TestVal(const std::string & val);
std::map<std::string, std::string >::iterator it = mapTest.begin();
while(it != mapTest.end())
{
if(TestVal(it->second))
{
mapTest.erase(it++);
}
else
it++;
}
通过std::map的erase方法在释放了it后会返回指向下一个元素的指针来获取最新的iterator