您能在迭代过程中从std:list中删除元素吗?
for (std::list<item*>::iterator i=items.begin();i!=items.end();i++){ bool isActive = (*i)->update(); //if (!isActive) // items.remove(*i); //else other_code_involving(*i);}items.remove_if(CheckItemNotActive);
i++
忽然笑
SMILET
江户川乱折腾
相关分类