#include <vector>
#include <algorithm>
using namespace std;
int main() {
vector<int> a = {1,2,3,7,1,5,4};
vector<int> b = {6,7,4,3,3,1,7};
a.erase(remove(a.begin(),a.end(),a[0]),a.end());
b.erase(remove(b.begin(),b.end(),b[0]),b.end());
return 1;
}
For this specific example, my GNU gdb Ubuntu 7.7.1 states that at return 1 line: a = {2,3,7,1,5,4} which is not expected (only deletes one 1), and b = {7,4,3,3,1} which is not expected.
My expectation is b should be a=2,3,7,5,4 and b=7,4,3,3,1,7.
What's happening here?