【发布时间】:2011-11-04 23:10:47
【问题描述】:
我们在一些 .h 文件中有一个成员函数
template <typename MutableBufferSequence>
int read_some(boost::asio::ip::tcp::socket& sock,
const MutableBufferSequence& buffers)
{
return sock.read_some(buffers);
}
我们希望在我们的一个类函数中包含这样的代码:
boost::packaged_task<int> pt(boost::bind(&http_request::read_some, this, &socket, boost::asio::buffer(buffer, buffer_size)));
这给了我 87 个编译器错误,并告诉我 boost::bind 不能以这种方式工作。我想知道如何通过boost::bind 将boost::asio::buffer 传递给我的函数?
【问题讨论】:
-
您作为第三个参数传递给
boost::bind()的socket变量的类型是什么?
标签: c++ boost boost-asio boost-bind