Let's say I have a std::vector of integers:
std::vector
std::vector<int> v;
v contains 100 elements, and I want to remove the last 10 elements. I can think of this solution:
v
v.erase(v.end() - 10, v.end());
Anything better?
Aucun commentaire:
Enregistrer un commentaire