how to remove something from a vector c++ code example
Example 1: remove element by index from vector c++
// Deletes the second element (vec[1])
vec.erase(vec.begin() + 1);
// Deletes the second through third elements (vec[1], vec[2])
vec.erase(vec.begin() + 1, vec.begin() + 3);
Example 2: vector erase specific element
vector.erase( vector.begin() + 3 ); // Deleting the fourth element