前者の質問の関数に、 boost::bind と boost::asioという 2 つのパラメータを追加したいと思います。boost::bind が機能しない、例からコピー
編集:申し訳ありませんが、timer_result のタイプを追加するのを忘れていました:boost::optional timer_result;
//my function
void CClient::setResult2(boost::optional<boost::system::error_code>* a, boost::system::error_code b,
const boost::system::error_code& error, std::size_t);
//my attempt: I'd like to set the value of the first, third and fourth parameters but not the second one
timer.async_wait(boost::bind(&CClient::setResult2, this, &timer_result, _1,boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
_1 は前の質問と何か違う意味ですか? ありがとう。
エラー:
Description Resource Path Location Type
required from ‘void boost::asio::basic_deadline_timer<Time,
TimeTraits, TimerService>::async_wait(WaitHandler&&) [with WaitHandler
= boost::_bi::bind_t<void, boost::_mfi::mf4<void, CClient, boost::optional<boost::system::error_code>*,
boost::system::error_code, const boost::system::error_code&, unsigned
int>, boost::_bi::list5<boost::_bi::value<CClient*>,
boost::_bi::value<boost::optional<boost::system::error_code>*>,
boost::arg<1>, boost::arg<1> (*)(), boost::arg<2> (*)()> >; Time =
boost::posix_time::ptime; TimeTraits =
boost::asio::time_traits<boost::posix_time::ptime>; TimerService =
boost::asio::deadline_timer_service<boost::posix_time::ptime,
boost::asio::time_traits<boost::posix_time::ptime> >]’ remote_server
line 501, external location:
/usr/include/boost/asio/basic_deadline_timer.hpp C/C++ Problem
invalid user-defined conversion from ‘const boost::system::error_code’
to ‘unsigned int’ [-fpermissive] remote_server line 525,
external location: /usr/include/boost/bind/bind.hpp C/C++ Problem
required from ‘void boost::_bi::list5<A1, A2, A3, A4,
A5>::operator()(boost::_bi::type<void>, F&, A&, int) [with F =
boost::_mfi::mf4<void, CClient,
boost::optional<boost::system::error_code>*,
boost::system::error_code, const boost::system::error_code&, unsigned
int>; A = boost::_bi::list1<const boost::system::error_code&>; A1 =
boost::_bi::value<CClient*>; A2 =
boost::_bi::value<boost::optional<boost::system::error_code>*>; A3 =
boost::arg<1>; A4 = boost::arg<1> (*)(); A5 = boost::arg<2> (*)()]’
remote_server line 525, external location:
/usr/include/boost/bind/bind.hpp C/C++ Problem size of array is
negative remote_server line 37, external location:
/usr/include/boost/bind/arg.hpp C/C++ Problem make: ***
[src/CClient.o] Error 1 remote_server C/C++
Problem required from ‘void boost::asio::detail::binder1<Handler,
Arg1>::operator()() [with Handler = boost::_bi::bind_t<void,
boost::_mfi::mf4<void, CClient,
boost::optional<boost::system::error_code>*,
boost::system::error_code, const boost::system::error_code&, unsigned
int>, boost::_bi::list5<boost::_bi::value<CClient*>,
boost::_bi::value<boost::optional<boost::system::error_code>*>,
boost::arg<1>, boost::arg<1> (*)(), boost::arg<2> (*)()> >; Arg1 =
boost::system::error_code]’ remote_server line 46,
external location: /usr/include/boost/asio/detail/bind_handler.hpp
C/C++ Problem required from ‘boost::_bi::bind_t<R, F,
L>::result_type boost::_bi::bind_t<R, F, L>::operator()(const A1&)
[with A1 = boost::system::error_code; R = void; F =
boost::_mfi::mf4<void, CClient,
boost::optional<boost::system::error_code>*,
boost::system::error_code, const boost::system::error_code&, unsigned
int>; L = boost::_bi::list5<boost::_bi::value<CClient*>,
boost::_bi::value<boost::optional<boost::system::error_code>*>,
boost::arg<1>, boost::arg<1> (*)(), boost::arg<2> (*)()>;
boost::_bi::bind_t<R, F, L>::result_type = void]’ remote_server
line 47, external location: /usr/include/boost/bind/bind_template.hpp
C/C++ Problem required from ‘void
boost_asio_handler_invoke_helpers::invoke(Function&, Context&) [with
Function = boost::asio::detail::binder1<boost::_bi::bind_t<void,
boost::_mfi::mf4<void, CClient,
boost::optional<boost::system::error_code>*,
boost::system::error_code, const boost::system::error_code&, unsigned
int>, boost::_bi::list5<boost::_bi::value<CClient*>,
boost::_bi::value<boost::optional<boost::system::error_code>*>,
boost::arg<1>, boost::arg<1> (*)(), boost::arg<2> (*)()> >,
boost::system::error_code>; Context = boost::_bi::bind_t<void,
boost::_mfi::mf4<void, CClient,
boost::optional<boost::system::error_code>*,
boost::system::error_code, const boost::system::error_code&, unsigned
int>, boost::_bi::list5<boost::_bi::value<CClient*>,
boost::_bi::value<boost::optional<boost::system::error_code>*>,
boost::arg<1>, boost::arg<1> (*)(), boost::arg<2> (*)()> >]’
remote_server line 39, external location:
/usr/include/boost/asio/detail/handler_invoke_helpers.hpp C/C++
Problem required from ‘void
boost::asio::asio_handler_invoke(Function, ...) [with Function =
boost::asio::detail::binder1<boost::_bi::bind_t<void,
boost::_mfi::mf4<void, CClient,
boost::optional<boost::system::error_code>*,
boost::system::error_code, const boost::system::error_code&, unsigned
int>, boost::_bi::list5<boost::_bi::value<CClient*>,
boost::_bi::value<boost::optional<boost::system::error_code>*>,
boost::arg<1>, boost::arg<1> (*)(), boost::arg<2> (*)()> >,
boost::system::error_code>]’ remote_server line 64,
external location: /usr/include/boost/asio/handler_invoke_hook.hpp
C/C++ Problem required from
‘boost::asio::detail::wait_handler<Handler>::wait_handler(Handler&)
[with Handler = boost::_bi::bind_t<void, boost::_mfi::mf4<void,
CClient, boost::optional<boost::system::error_code>*,
boost::system::error_code, const boost::system::error_code&, unsigned
int>, boost::_bi::list5<boost::_bi::value<CClient*>,
boost::_bi::value<boost::optional<boost::system::error_code>*>,
boost::arg<1>, boost::arg<1> (*)(), boost::arg<2> (*)()> >]’
remote_server line 39, external location:
/usr/include/boost/asio/detail/wait_handler.hpp C/C++ Problem
required from ‘static void
boost::asio::detail::wait_handler<Handler>::do_complete(boost::asio::detail::io_service_impl*,
boost::asio::detail::operation*, const boost::system::error_code&,
std::size_t) [with Handler = boost::_bi::bind_t<void,
boost::_mfi::mf4<void, CClient,
boost::optional<boost::system::error_code>*,
boost::system::error_code, const boost::system::error_code&, unsigned
int>, boost::_bi::list5<boost::_bi::value<CClient*>,
boost::_bi::value<boost::optional<boost::system::error_code>*>,
boost::arg<1>, boost::arg<1> (*)(), boost::arg<2> (*)()> >;
boost::asio::detail::io_service_impl =
boost::asio::detail::task_io_service; boost::asio::detail::operation =
boost::asio::detail::task_io_service_operation; std::size_t = unsigned
int]’ remote_server line 69, external location:
/usr/include/boost/asio/detail/wait_handler.hpp C/C++ Problem
make: *** No rule to make target `all'. C/C++
Problem required from ‘void
boost::asio::deadline_timer_service<TimeType,
TimeTraits>::async_wait(boost::asio::deadline_timer_service<TimeType,
TimeTraits>::implementation_type&, WaitHandler&&) [with WaitHandler =
boost::_bi::bind_t<void, boost::_mfi::mf4<void, CClient,
boost::optional<boost::system::error_code>*,
boost::system::error_code, const boost::system::error_code&, unsigned
int>, boost::_bi::list5<boost::_bi::value<CClient*>,
boost::_bi::value<boost::optional<boost::system::error_code>*>,
boost::arg<1>, boost::arg<1> (*)(), boost::arg<2> (*)()> >; TimeType =
boost::posix_time::ptime; TimeTraits =
boost::asio::time_traits<boost::posix_time::ptime>;
boost::asio::deadline_timer_service<TimeType,
TimeTraits>::implementation_type =
boost::asio::detail::deadline_timer_service<boost::asio::time_traits<boost::posix_time::ptime>
>::implementation_type]’ remote_server line 138, external location: /usr/include/boost/asio/deadline_timer_service.hpp C/C++
Problem required from ‘void
boost::asio::detail::deadline_timer_service<Time_Traits>::async_wait(boost::asio::detail::deadline_timer_service<Time_Traits>::implementation_type&,
Handler) [with Handler = boost::_bi::bind_t<void,
boost::_mfi::mf4<void, CClient,
boost::optional<boost::system::error_code>*,
boost::system::error_code, const boost::system::error_code&, unsigned
int>, boost::_bi::list5<boost::_bi::value<CClient*>,
boost::_bi::value<boost::optional<boost::system::error_code>*>,
boost::arg<1>, boost::arg<1> (*)(), boost::arg<2> (*)()> >;
Time_Traits = boost::asio::time_traits<boost::posix_time::ptime>]’
remote_server line 180, external location:
/usr/include/boost/asio/detail/deadline_timer_service.hpp C/C++
Problem required from here CClient.cpp /remote_server/src
line 102 C/C++ Problem
情報:
Description Resource Path Location Type candidate is:
boost::system::error_code::operator boost::system::error_code::unspecified_bool_type() const <near match>
remote_server line 355, external location:
/usr/include/boost/system/error_code.hpp C/C++ Problem no known conversion for implicit ‘this’ parameter from ‘boost::system::error_code::unspecified_bool_type {aka void (*)()}’ to ‘unsigned int’ remote_server line 355, external
location: /usr/include/boost/system/error_code.hpp C/C++ Problem