Hello,
I am trying to use "remove_if" with a predicate function inside a class. The code intends to remove the grid cells which an agent cannot move into (from among all possible cells).
That code would work if it was not in a class and the predicate was not a member function. However, now I receive long error messages which I guess refer to incompatibility of remove_if template with the predicate parameter (one error includes : error C2064: term does not evaluate to a function taking 1 arguments).Code:void classname::function1() { vector<MoorePoint> neighbors; .... neighbors.erase(std::remove_if(neighbors.begin(),neighbors.end(),&classname::cannotMoveIn), neighbors.end()); ... } bool classname::cannotMoveIn(MoorePoint mp) { return !mp.inGridNotOccupied; }
Does anyone have any idea what is wrong?
Thanks.




Reply With Quote
