我有编译这段代码错误的升压:ASIO:带升压read_until问题::绑定
/usr/include/boost/bind/bind_mf_cc.hpp:91:5一个问题:错误:初始化参数5:'boost :: _ bi :: bind_t,typename boost :: _ bi :: list_av_4 :: type> boost :: bind(R(T :: *)(B1,B2,B3),A1,A2,A3,A4 )[与R = void; T = tcpReader; B1 = const boost :: system :: error_code &; B2 = unsigned int; B3 = boost :: asio :: basic_streambuf <> &; A1 = tcpReader *; A2 = boost :: system :: error_code; A3 = unsigned int; A4 = boost :: asio :: basic_streambuf <>; typename boost :: _ bi :: list_av_4 :: type = boost :: _ bi :: list4,boost :: _ bi :: value,boost :: _ bi :: value,boost :: _ bi :: value >>]
void tcpReader::handle_read(const boost::system::error_code& ec, std::size_t bytes_transferred, boost::asio::streambuf& buf)
// inside a class method
boost::asio::streambuf buf;
boost::asio::async_read_until(*sock,buf,"\n" ,
boost::bind(&tcpReader::handle_read,this,error,buf.size(),buf)
);
有什么问题是什么想法?它我知道我错过了一些简单的东西,但我无法弄清楚它是否像我将不得不使用boot :: buffer?
在此先感谢
你应该使用'提高:: ASIO ::占位符:: error'和'的boost ::支持ASIO ::占位符:: bytes_transferred',而不是'err'和'BUF。 size()'分别? – Chad 2012-07-17 15:34:46
您也可能需要用'boost :: ref(buf)'来包装最后的参数'buf'。 – Chad 2012-07-17 15:35:40