The boost asio deadline_timer async_wait function is taking handler of the form :
void handler(const boost::system::error_code& error)
How could I define a handler which takes in const boost::system::error_code& error and also an argument of type int ?
boost::asio::deadline_timer t(io_service);
t.async_wait(handler); //I need the async_wait to take in handler which accepts argument boost::system::error_code& error and an int
void handler(int, const boost::system::error_code& error )//extra int argument
Thanks.
You could use Boost.Bind to provide a value for the first argument :
Here, the handler will be called with a 0 as its first argument and the
error_codewill simply be forwarded as a second argument.