For example, the following statement removes all elements that have the value val:
...
//remove all elements with value val
coll.erase(remove(coll.begin(),coll.end(),
val),
coll.end());
To remove only the first element that has a certain value, you must use the following statements:
...
//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);
}