You might perform the following to remove a single element:
std::vector<int> vec;
vec.push_back(6);
vec.push_back(-17);
vec.push_back(12);
// Deletes the second element (vec[1])
vec.erase(std::next(vec.begin()));
Alternatively, to remove many elements at once:
// ...READ MORE
Jun 10, 2022
in C++
by
Damon
• 4,960 points
•
1,734 views