c++ - Access member of returned struct in boost lambda/phoenix -
i want replace older code simpler, functor based code. don't want introduce functor class , use boost::lambda/phoenix don't have c++11 @ hand.
old code looks this
int player = ...; point middlept = ...; for(point pt=<magic nested loops>) if(this->ismilitarybuilding(pt) && (this->getnode(pt).owner == player + 1)) return true; return false;
i have function calls functor every point (encapsulating magic) , returns true when of calls returns true:
template<class functor> bool checkpts(point middlept, functor f);
translating first part of if
easy:
return checkpts(middlept, bind(&ismilitarybuilding, this, _1));
and 2nd i'd want like: bind(&getnode, this, _1).owner == player+1
not supported.
what readable way of doing this? think might solvable binding reference this
, calling functions directly using phoenix lambda did not found references go beyond simple 'hello world' lambdas accessing simple member or parameter.
Comments
Post a Comment