vector elements are removed

removes the first element in the vector "is equal to a value".

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);

}

 

Guess you like

Origin www.cnblogs.com/herd/p/11439960.html