Check out example codes for "c++ vector remove element by value". It will help you in understanding the concepts better.

Code Example 1

#include <algorithm>
#include <vector>

// using the erase-remove idiom

std::vector<int> vec {2, 4, 6, 8};
int value = 8 // value to be removed
vec.erase(std::remove(vec.begin(), vec.end(), value), vec.end());

Code Example 2

Input  : myvector= {1, 2, 3, 4, 5};
         myvector.clear();
Output : myvector= {}

Code Example 3

carVec.erase(std::remove_if(carVec.begin(), carVec.end(), [&id_to_delete](const Car& ele)->bool
            {
                return ele.getnewId() == id_to_delete;
            }), carVec.end());

Learn ReactJs, React Native from akashmittal.com