
claud.86@email.it wrote:
Hi to all, i use libboost recently, it is the ideal solution for my software c++. Now I'm using asio and I need to invoke a function like this:
fun(time_from_string("2010-01-30 5:03:02"),bind(&timer::run,this));
The body of fun will look like this:
void fun(ptime t,void h) { ... timer.async_wait(h); ... }
Obviously the return of the type of bind is not void and that is why there is an error. What kind should be the h parameter? Which is the prototype of fun?
Usage questions about boost should go to the boost-help mailing list. You need to make fun a template over the function parameter. The return type can be derived using Boost's result_of protocol. I'm not 100% sure about the details, but it should be something like template <typename Fn> typename boost::result_of<Fn>::type run_at(ptime at, Fn fn); Sebastian