首页 > 代码库 > list中删除指针元素

list中删除指针元素

vector<Entity*> Entities;/* Fill vector here */vector<Entity*>::iterator it;for ( it = Entities.begin(); it != Entities.end(); )   if( (*it)->getXPos() > 1.5f )      delete * it;        it = Entities.erase(it);   }   else {      ++it;   }}

  

list中删除指针元素