I\'m writing an application that uses boost::asio. Asio\'s async_receive (or async_read) is invariably shown using a boost::bind
Use boost::function:
class Whatever
{
public:
Whatever()
{
functor = boost::bind(
&chat_session::handle_read_header,
shared_from_this(),
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred
);
boost::asio::async_read(
socket_,
boost::asio::buffer(
read_msg_.data(),
chat_message::header_length
),
functor
);
}
private:
boost::function functor;
};
... or something like that.