boost库future与then使用

开发者在使用Boost161和OpenCV4.6.0时遇到编译错误,涉及shared_future::then函数调用问题。寻求解决方案,因为相同的代码在不同版本的Boost中表现不一致。

outermost_context().components.camera_component->get_image(CameraEnums::NextImage)
.then(outermost_context().continuation_executor,
InStateHandler<Preparing, boost::shared_ptradam::firmware::ImageData >(
&outermost_context(),
boost::bind(
&Preparing::check_exposure_stability,
this,
1)));
在boost161+opencv3.1.0编译可以通过,在boost161+opencv4.6.0无法通过,请问有高手知道怎么解决吗?
boost161+opencv4.6.0编译报错如下:
/home/lwx/firm161/application/control/states/preparing.cpp:58:25: error: no matching function for call to ‘boost::shared_future<boost::shared_ptradam::firmware::ImageData >::then(adam::infra::SchedulerExecutor<>&, adam::firmware::states::InStateHandler<adam::firmware::states::Preparing, boost::shared_ptradam::firmware::ImageData >)’
1)));
^
In file included from /usr/local/include/boost/thread.hpp:24:0,
from /home/lwx/firm161/hal/…/infra/worker_service.h:9,
from /home/lwx/firm161/hal/…/vision/tracking/template_scoring.h:5,
from /home/lwx/firm161/hal/…/vision/tracking/position_enumeration.h:5,
from /home/lwx/firm161/hal/…/vision/tracking/door_tracker.h:3,
from /home/lwx/firm161/hal/…/application/image_data.h:20,
from /home/lwx/firm161/application/control/states/preparing.h:5,
from /home/lwx/firm161/application/control/states/preparing.cpp:2:
/usr/local/include/boost/thread/future.hpp:2130:9: note: candidate: template boost::future<typename boost::result_of<F(boost::shared_future)>::type> boost::shared_future::then(F&&) const [with F = F; R = boost::shared_ptradam::firmware::ImageData]
then(BOOST_THREAD_FWD_REF(F) func) const; // EXTENSION
^
/usr/local/include/boost/thread/future.hpp:2130:9: note: template argument deduction/substitution failed:
/home/lwx/firm161/application/control/states/preparing.cpp:58:25: note: candidate expects 1 argument, 2 provided
1)));
^
In file included from /usr/local/include/boost/thread.hpp:24:0,
from /home/lwx/firm161/hal/…/infra/worker_service.h:9,
from /home/lwx/firm161/hal/…/vision/tracking/template_scoring.h:5,
from /home/lwx/firm161/hal/…/vision/tracking/position_enumeration.h:5,
from /home/lwx/firm161/hal/…/vision/tracking/door_tracker.h:3,
from /home/lwx/firm161/hal/…/application/image_data.h:20,
from /home/lwx/firm161/application/control/states/preparing.h:5,
from /home/lwx/firm161/application/control/states/preparing.cpp:2:
/usr/local/include/boost/thread/future.hpp:2133:9: note: candidate: template boost::future<typename boost::result_of<F(boost::shared_future)>::type> boost::shared_future::then(boost::launch, F&&) const [with F = F; R = boost::shared_ptradam::firmware::ImageData]
then(launch policy, BOOST_THREAD_FWD_REF(F) func) const; // EXTENSION
^
/usr/local/include/boost/thread/future.hpp:2133:9: note: template argument deduction/substitution failed:
/home/lwx/firm161/application/control/states/preparing.cpp:52:35: note: cannot convert ‘((adam::firmware::states::Preparing*)this)->adam::firmware::states::Preparing::.boost::statechart::state<adam::firmware::states::Preparing, adam::firmware::states::Viewing>::.boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context<adam::firmware::states::Preparing, adam::firmware::states::Viewing, boost::mpl::list<mpl
::na, mpl
::na, mpl
::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, (boost::statechart::history_mode)0u>().adam::firmware::StateMachine::continuation_executor’ (type ‘adam::infra::SchedulerExecutor<>’) to type ‘boost::launch’
.then(outermost_context().continuation_executor,
^
In file included from /usr/local/include/boost/thread.hpp:24:0,
from /home/lwx/firm161/hal/…/infra/worker_service.h:9,
from /home/lwx/firm161/hal/…/vision/tracking/template_scoring.h:5,
from /home/lwx/firm161/hal/…/vision/tracking/position_enumeration.h:5,
from /home/lwx/firm161/hal/…/vision/tracking/door_tracker.h:3,
from /home/lwx/firm161/hal/…/application/image_data.h:20,
from /home/lwx/firm161/application/control/states/preparing.h:5,
from /home/lwx/firm161/application/control/states/preparing.cpp:2:
/usr/local/include/boost/thread/future.hpp:2137:9: note: candidate: template<class Ex, class F> boost::future<typename boost::result_of<F(boost::shared_future)>::type> boost::shared_future::then(Ex&, F&&) const [with Ex = Ex; F = F; R = boost::shared_ptradam::firmware::ImageData]
then(Ex& ex, BOOST_THREAD_FWD_REF(F) func) const; // EXTENSION
^
/usr/local/include/boost/thread/future.hpp:2137:9: note: template argument deduction/substitution failed:
/usr/local/include/boost/thread/future.hpp: In substitution of ‘template<class Ex, class F> boost::future<typename boost::result_of<F(boost::shared_future)>::type> boost::shared_future::then(Ex&, F&&) const [with Ex = adam::infra::SchedulerExecutor<>; F = adam::firmware::states::InStateHandler<adam::firmware::states::Preparing, boost::shared_ptradam::firmware::ImageData >]’:
/home/lwx/firm161/application/control/states/preparing.cpp:58:25: required from here
/usr/local/include/boost/thread/future.hpp:5059:3: error: no type named ‘type’ in ‘struct boost::result_of<adam::firmware::states::InStateHandler<adam::firmware::states::Preparing, boost::shared_ptradam::firmware::ImageData >(boost::shared_future<boost::shared_ptradam::firmware::ImageData >)>’
shared_future::then(Ex& ex, BOOST_THREAD_FWD_REF(F) func) const
^
/home/lwx/firm161/application/control/states/preparing.cpp: In member function ‘void adam::firmware::states::Preparing::check_exposure_stability(boost::shared_future<boost::shared_ptradam::firmware::ImageData >)’:

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值