delete vector element by value code example
Example 1: c++ remove element from vector
vector.erase(position) // remove certain position
// or
vector.erase(left,right) // remove positions within range
Example 2: c++ vector remove element by value
carVec.erase(std::remove_if(carVec.begin(), carVec.end(), [&id_to_delete](const Car& ele)->bool
{
return ele.getnewId() == id_to_delete;
}), carVec.end());