I have some legacy code I'd like to rewrite in C++11 style.
There are some boost::function
defined as following
// void One::first(int)
boost::function<void()> a1 = boost::bind(&One::first, this, this->a);
// void Two::second()
boost::function<void()> a2 = boost::bind(&Two::second, this);
// void Three::third(int, const std::string &)
boost::function<void()> a3 = boost::bind(&Three::third, this, 8, str);
These variables are passed to function foo
in different places:
foo(somearg, a1);
foo(anotherarg, a2);
foo(othearg, a3);
where foo
is defined like following
void foo(const Obj &obj, boost::function<void()> caller) {
...
caller();
...
}
What is the best way to rewrite this code in C++11 style?