hi, I'm fairly new to c++. I found this generic question is a book asking to spot the error in the code, but no answer was given. this has been doing my head for a few days now:
void function(std::vector<int> v){
A* _a = new A
std::vector< int >::iterator it = v.begin();
for(; it != v.end();it++){
_a->f(*it);
}
}
if A::f() is not a const method, your function will have no effect on the vecotr, since the vector is passed by value, so the function is run on a copy of the vector