In article <ee**********@c ache.uni-koblenz.de>,
"Christian Bruckhoff" <br******@uni-koblenz.dewrote :
Hi.
Is there a possibility to delete elements out of a vector?
At the moment i do it by copying all needed elements to another vector.
After clearing the old vector i copy them back element by element.
All sequences, including std::vector have an 'erase' member-function.
a.erase(p)
p is a dereferenceable iterator in a.
Destroys the element pointed to by p and removes it from a.
a.size() is decremented by 1. The relative order of the other elements
in the sequence is unchanged. The return value is an iterator to the
element immediately following the one that was erased.
Warning: there is no guarantee that a valid iterator on a is still valid
after an insertion or an erasure. In some cases iterators do remain
valid, and in other cases they do not. The details are different for
each sequence class.
--
There are two things that simply cannot be doubted. Logic and our
ability to sense the world around us. Doubt those, and you no longer
have anyone to discuss it with, nor any ability to discuss it.