vector 移除元素
vector中移除“与某值相等”的第一个元素。
std::vector<Elem> coll; ... //remove first element with value val std::vector<Elem>::iterator pos; pos = find(coll.begin(),coll.end(),val); if(pos != coll.end()) { coll.erase(pos); }
QQ 3087438119
vector中移除“与某值相等”的第一个元素。
std::vector<Elem> coll; ... //remove first element with value val std::vector<Elem>::iterator pos; pos = find(coll.begin(),coll.end(),val); if(pos != coll.end()) { coll.erase(pos); }