14 Apr
2011
14 Apr
'11
12:13 a.m.
you probably really do want to look into an event system that will prescribe a bit of pre-built organization but if you just want to store the bind for later boost function will do it. http://www.boost.org/doc/libs/1_46_1/doc/html/function.html #include <boost/bind.hpp> #include <boost/function.hpp> #include <iostream> boost::function<void (std::string)> func; class Object { void runner(std::string message) { std::cout << message << std::endl; } public: void assign() { func = boost::bind(&Object::runner, this, _1); } }; int main(int argc, char **argv) { Object obj; obj.assign(); func("my message"); return 0; }