I am trying to post data to io_context, if I bind post with newdata method (with no parameter) it get called, however if I pass any parameter it failed to call newdata method.
std::shared_ptr< boost::asio::io_context >ioc = std::make_shared<boost::asio::io_context>();
:
ioc->post(boost::bind(&myclass::newdata, this)); /// <-- this get called
ioc->post(boost::bind(&myclass::newdata, this, 1)); /// <-- this get failed, no compile time error
// I tried with boost::function, but it failed to compile
boost::function<void(int>)> p(boost::bind(&myclass::newdata, this, _1));
ioc->post(p(1)); // <-- compile time error