cpp remove element code example
Example 1: c++ remove element from vector
vector.erase(position) // remove certain position
// or
vector.erase(left,right) // remove positions within range
Example 2: c++ remove item from list
// remove from list
#include <iostream>
#include <list>
int main ()
{
int myints[]= {17,89,7,14};
std::list<int> mylist (myints,myints+4);
mylist.remove(89);
std::cout << "mylist contains:";
for (std::list<int>::iterator it=mylist.begin(); it!=mylist.end(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
return 0;
}