Zebra0.com

cpp vectorsSearch and erase from a vector

Search and erase from a vector

This short program illustrates searching for and erasing an element of a vector.

Notice that we use a template so this will work for any type vector.

The vector class erase method can accept either the starting position of the element to be erased or the start and end points.