So here is the problem, I got two vectors, the first is a vector of Objects*, the second of int. When I erase specific element in Objects vector, the size is changed, but when I try it on the vector of int, the size remains the same. Here is the code:
Scenario1:
//vector<Object*> list;
//list.pushback(&ob);
//list.pushback(&ob2);
list.erase(std::remove(list.begin(), list.end(), ob), list.end());
cout<<list.size(); //size 1
Scenario2:
//vector<int> list2;
//list2.pushback(1);
//list2.pushback(2);
list2.erase(std::remove(list2.begin(), list2.end(), 1), list2.end());
cout<<list2.size(); //size 2 ??
Aucun commentaire:
Enregistrer un commentaire