Check out example codes for "vector remove class". It will help you in understanding the concepts better.

Code Example 1

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