Is it possible to overload -=
like this without it being a method of a class?
vector<int>& operator-=(int a, int b){
vector<int> v;
v.push_back(a); v.push_back(b);
return v
}
I have a line in a homework assignment that looks something like this:
SomeStructure-=1-=2-=3;
What it is supposed to do is remove the elements with the indexes 1, 2 and 3 from the structure(in that order).
It seems like the option I tried above is not possible (I was thinking of collecting all the indexes in a vector and then removing them from the structure one by one). Is there some other way to do this?