I need to map some state to a particular member function of a class, for (a very cut down) example:
class Z {
_a_ptr_to_some_member _p;
void UpdateGuiForStopState(State s) {
// do something with state
}
Z() {
// setup _p to point to UpdateGuiForStopState
}
void StateComesInHere(State s) {
if(s.id == STOP_ID) { // eventually use lookup
_p(s);
}
}
}
Using just the STL (can’t use third party stuff like boost), What is the type of _a_ptr_to_some_member and how do I bind the method UpdateGuiForStopState to it?
Presumably I use the stl mem_xxx stuff but can’t work out how.
And yes I can do this a hundred and one other different ways, but I want to work out if this way is possible.
Using STL’s
bind1standmem_fun: