0
我面臨問題結合boost ::功能與boost :: bind和boost :: asio。我面臨代碼片斷,編譯器會拋出大量錯誤,我正在粘貼根錯誤。錯誤使用升壓::功能與升壓::升壓::綁定:: asio
static void
startAccept(boost::asio::io_service &io,
boost::asio::ssl::context &ctx,
boost::asio::ip::tcp::acceptor &acceptor_,
const boost::system::error_code &ec
)
{
//details omitted for brevity reasons.
return;
}
boost::function<void(
boost::asio::io_service &,
boost::asio::ssl::context &,
boost::asio::ip::tcp::acceptor &,
boost::system::error_code &
)> f;
f = boost::bind(&startAccept,
boost::ref(io),
boost::ref(ctx),
boost::ref(acceptor_),
boost::asio::placeholders::error);
錯誤:
In file included from as.cc:5:
In file included from /usr/local/include/boost/bind.hpp:22:
/usr/local/include/boost/bind/bind.hpp:457:93: error: no viable conversion from 'boost::asio::io_service' to
'const boost::system::error_code'
unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
^~~~~~~~~~~~~~~~~
/usr/local/include/boost/system/error_code.hpp:317:11: note: candidate constructor (the implicit copy constructor) not viable: no known
conversion from 'boost::asio::io_service' to 'const boost::system::error_code &' for 1st argument
class error_code
^
/usr/local/include/boost/system/error_code.hpp:317:11: note: candidate constructor (the implicit move constructor) not viable: no known
conversion from 'boost::asio::io_service' to 'boost::system::error_code &&' for 1st argument
class error_code
^
爲什麼編譯器試圖轉換的boost :: ASIO :: io_service對象的boost ::系統:: ERROR_CODE?