Hi,
I would like to bind a function which takes a boost::function<void> as
parameter, let's say
void caller(boost::function& f) { f(); }
void foo() {}
boost::function foo_fun = &foo; boost::bind(caller, foo_fun)();
But what if the function has a parameter, for example
void bar(int i) {}
How can I create the folling a function object?
boost::function
The function object should take an int, bind it to bar and then call caller
with the resulting nullary function.
boost::function bar_fun = &bar;
// doesn't work because caller and bar are being composed.
boost:bind(caller, boost::bind(bar_fun, _1))
// doesn't work because caller doesn't accept a unary function.
boost:bind(caller, boost::protect(boost::bind(bar_fun, _1)))
Does anyone have a clean solution for that?
boost::protect doesn't provide the option to evaluate the arguments (_1) but
_not_ perform a composition.
Regards,
Christian