C++ remove first element vector code example
Example 1: c++ vector pop first element
std::vector<int> vect;
vect.erase(vect.begin());
Example 2: 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);