boost::asio中的 不懂这句话的意思??
void async_read(T& t, Handler handler)
{
// Issue a read operation to read exactly the number of bytes in a header.
void (connection::*f)(
const boost::system::error_code&,
T&, boost::tuple<Handler>)
= &connection::handle_read_header<T, Handler>;
boost::asio::async_read(socket_, boost::asio::buffer(inbound_header_),
boost::bind(f,
this, boost::asio::placeholders::error, boost::ref(t),
boost::make_tuple(handler)));
}
template <typename T, typename Handler>
void handle_read_header(const boost::system::error_code& e,
T& t, boost::tuple<Handler> handler)
红字部分是什么意思是啊??求教
[解决办法]
connection::*f 这个算是类里的什么东西?
答:你的connection里面的一个方法.
可以再函数里 再申明 void (connection::*f)
答:调用connection里面的一个方法f形成一个void类型的指针函数,指向某一个你的函数地址.就像你后面的=&操作符。