C++知识点—01 <noexcept>

— 工作所遇随手记,方便自己查看


参考文章

一、 关键字 noexcept

  • 该关键字告诉编译器,函数中不会发生异常(有利于编译器对程序做更多的优化)
  • 在运行时,noexcept函数向外抛出异常(如果函数内部捕捉了异常并完成处理,不算抛出异常),程序会直接终止,调用  std::terminate( )  函数,该函数内部会调用  std::abort( )  终止程序
  • std::terminate 函数 (在程序
xin@user:~/mark_ws$ colcon build Starting >>> class Starting >>> office Finished <<< office [0.11s] --- stderr: class In file included from /opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:24, from /opt/ros/humble/include/rclcpp/rclcpp/client.hpp:40, from /opt/ros/humble/include/rclcpp/rclcpp/callback_group.hpp:24, from /opt/ros/humble/include/rclcpp/rclcpp/any_executable.hpp:20, from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategy.hpp:25, from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategies.hpp:18, from /opt/ros/humble/include/rclcpp/rclcpp/executor_options.hpp:20, from /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:37, from /opt/ros/humble/include/rclcpp/rclcpp/executors/multi_threaded_executor.hpp:25, from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:21, from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155, from /home/xin/mark_ws/class/src/wang.cpp:1: /home/xin/mark_ws/class/src/wang.cpp: In member function ‘void StudentNode::mark_callback(std_msgs::msg::Float32MultiArray_<std::allocator<void> >::SharedPtr)’: /home/xin/mark_ws/class/src/wang.cpp:16:40: warning: format ‘%s’ expects argument of type ‘char*’, but argument 5 has type ‘std_msgs::msg::Float32MultiArray_<std::allocator<void> >::_data_type’ {aka ‘std::vector<float>’} [-Wformat=] 16 | RCLCPP_INFO(this->get_logger(),"收到分数了,我考了%s",mark->data); | ^~~~~~~~~~~~~~~~~~~~~ /home/xin/mark_ws/class/src/wang.cpp:16:59: note: format string is defined here 16 | RCLCPP_INFO(this->get_logger(),"收到分数了,我考了%s",mark->data); | ~^ | | | char* In file included from /opt/ros/humble/include/rclcpp/rclcpp/subscription_base.hpp:32, from /opt/ros/humble/include/rclcpp/rclcpp/callback_group.hpp:29, from /opt/ros/humble/include/rclcpp/rclcpp/any_executable.hpp:20, from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategy.hpp:25, from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategies.hpp:18, from /opt/ros/humble/include/rclcpp/rclcpp/executor_options.hpp:20, from /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:37, from /opt/ros/humble/include/rclcpp/rclcpp/executors/multi_threaded_executor.hpp:25, from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:21, from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155, from /home/xin/mark_ws/class/src/wang.cpp:1: /opt/ros/humble/include/rclcpp/rclcpp/any_subscription_callback.hpp: In instantiation of ‘rclcpp::AnySubscriptionCallback<MessageT, AllocatorT> rclcpp::AnySubscriptionCallback<MessageT, AllocatorT>::set(CallbackT) [with CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; AllocatorT = std::allocator<void>]’: /opt/ros/humble/include/rclcpp/rclcpp/subscription_factory.hpp:94:32: required from ‘rclcpp::SubscriptionFactory rclcpp::create_subscription_factory(CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr, std::shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<ROSMessageType> >) [with MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; SubscriptionT = rclcpp::Subscription<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> >; ROSMessageType = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> > >]’ /opt/ros/humble/include/rclcpp/rclcpp/create_subscription.hpp:122:63: required from ‘std::shared_ptr<ROSMessageT> rclcpp::detail::create_subscription(NodeParametersT&, NodeTopicsT&, const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; SubscriptionT = rclcpp::Subscription<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> >; NodeParametersT = rclcpp::Node; NodeTopicsT = rclcpp::Node; ROSMessageType = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> > >]’ /opt/ros/humble/include/rclcpp/rclcpp/create_subscription.hpp:191:76: required from ‘std::shared_ptr<ROSMessageT> rclcpp::create_subscription(NodeT&, const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; SubscriptionT = rclcpp::Subscription<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> >; NodeT = rclcpp::Node; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> > >]’ /opt/ros/humble/include/rclcpp/rclcpp/node_impl.hpp:99:47: required from ‘std::shared_ptr<ROSMessageT> rclcpp::Node::create_subscription(const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; SubscriptionT = rclcpp::Subscription<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> >; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> > >]’ /home/xin/mark_ws/class/src/wang.cpp:25:77: required from here /opt/ros/humble/include/rclcpp/rclcpp/any_subscription_callback.hpp:391:22: error: no matching function for call to ‘std::function<void(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>::function(std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>&)’ 391 | set_deprecated(static_cast<typename scbth::callback_type>(callback)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/11/future:47, from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:18, from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155, from /home/xin/mark_ws/class/src/wang.cpp:1: /usr/include/c++/11/bits/std_function.h:435:9: note: candidate: ‘template<class _Functor, class _Constraints> std::function<_Res(_ArgTypes ...)>::function(_Functor&&) [with _Functor = _Functor; _Constraints = _Constraints; _Res = void; _ArgTypes = {std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >}]’ 435 | function(_Functor&& __f) | ^~~~~~~~ /usr/include/c++/11/bits/std_function.h:435:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/11/bits/move.h:57, from /usr/include/c++/11/bits/stl_pair.h:59, from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/memory:63, from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:153, from /home/xin/mark_ws/class/src/wang.cpp:1: /usr/include/c++/11/type_traits: In substitution of ‘template<bool _Cond, class _Tp> using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’: /usr/include/c++/11/bits/std_function.h:353:8: required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Cond, class _Tp> using _Requires = std::__enable_if_t<_Cond::value, _Tp> [with _Cond = std::function<void(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>::_Callable<std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>&, std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>, std::__invoke_result<std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>&, std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > > > >; _Tp = void; _Res = void; _ArgTypes = {std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >}]’ /usr/include/c++/11/bits/std_function.h:434:9: required from ‘rclcpp::AnySubscriptionCallback<MessageT, AllocatorT> rclcpp::AnySubscriptionCallback<MessageT, AllocatorT>::set(CallbackT) [with CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; AllocatorT = std::allocator<void>]’ /opt/ros/humble/include/rclcpp/rclcpp/subscription_factory.hpp:94:32: required from ‘rclcpp::SubscriptionFactory rclcpp::create_subscription_factory(CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr, std::shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<ROSMessageType> >) [with MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; SubscriptionT = rclcpp::Subscription<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> >; ROSMessageType = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> > >]’ /opt/ros/humble/include/rclcpp/rclcpp/create_subscription.hpp:122:63: required from ‘std::shared_ptr<ROSMessageT> rclcpp::detail::create_subscription(NodeParametersT&, NodeTopicsT&, const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; SubscriptionT = rclcpp::Subscription<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> >; NodeParametersT = rclcpp::Node; NodeTopicsT = rclcpp::Node; ROSMessageType = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> > >]’ /opt/ros/humble/include/rclcpp/rclcpp/create_subscription.hpp:191:76: required from ‘std::shared_ptr<ROSMessageT> rclcpp::create_subscription(NodeT&, const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; SubscriptionT = rclcpp::Subscription<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> >; NodeT = rclcpp::Node; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> > >]’ /opt/ros/humble/include/rclcpp/rclcpp/node_impl.hpp:99:47: required from ‘std::shared_ptr<ROSMessageT> rclcpp::Node::create_subscription(const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; SubscriptionT = rclcpp::Subscription<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> >; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> > >]’ /home/xin/mark_ws/class/src/wang.cpp:25:77: required from here /usr/include/c++/11/type_traits:2205:11: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’ 2205 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~~~ In file included from /usr/include/c++/11/future:47, from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:18, from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155, from /home/xin/mark_ws/class/src/wang.cpp:1: /opt/ros/humble/include/rclcpp/rclcpp/any_subscription_callback.hpp: In instantiation of ‘rclcpp::AnySubscriptionCallback<MessageT, AllocatorT> rclcpp::AnySubscriptionCallback<MessageT, AllocatorT>::set(CallbackT) [with CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; AllocatorT = std::allocator<void>]’: /opt/ros/humble/include/rclcpp/rclcpp/subscription_factory.hpp:94:32: required from ‘rclcpp::SubscriptionFactory rclcpp::create_subscription_factory(CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr, std::shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<ROSMessageType> >) [with MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; SubscriptionT = rclcpp::Subscription<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> >; ROSMessageType = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> > >]’ /opt/ros/humble/include/rclcpp/rclcpp/create_subscription.hpp:122:63: required from ‘std::shared_ptr<ROSMessageT> rclcpp::detail::create_subscription(NodeParametersT&, NodeTopicsT&, const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; SubscriptionT = rclcpp::Subscription<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> >; NodeParametersT = rclcpp::Node; NodeTopicsT = rclcpp::Node; ROSMessageType = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> > >]’ /opt/ros/humble/include/rclcpp/rclcpp/create_subscription.hpp:191:76: required from ‘std::shared_ptr<ROSMessageT> rclcpp::create_subscription(NodeT&, const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; SubscriptionT = rclcpp::Subscription<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> >; NodeT = rclcpp::Node; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> > >]’ /opt/ros/humble/include/rclcpp/rclcpp/node_impl.hpp:99:47: required from ‘std::shared_ptr<ROSMessageT> rclcpp::Node::create_subscription(const string&, const rclcpp::QoS&, CallbackT&&, const rclcpp::SubscriptionOptionsWithAllocator<AllocatorT>&, typename MessageMemoryStrategyT::SharedPtr) [with MessageT = std_msgs::msg::Float32MultiArray_<std::allocator<void> >; CallbackT = std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>; AllocatorT = std::allocator<void>; SubscriptionT = rclcpp::Subscription<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >; MessageMemoryStrategyT = rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> >; std::string = std::__cxx11::basic_string<char>; typename MessageMemoryStrategyT::SharedPtr = std::shared_ptr<rclcpp::message_memory_strategy::MessageMemoryStrategy<std_msgs::msg::Float32MultiArray_<std::allocator<void> >, std::allocator<void> > >]’ /home/xin/mark_ws/class/src/wang.cpp:25:77: required from here /usr/include/c++/11/bits/std_function.h:404:7: note: candidate: ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = void; _ArgTypes = {std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >}]’ 404 | function(function&& __x) noexcept | ^~~~~~~~ /usr/include/c++/11/bits/std_function.h:404:27: note: no known conversion for argument 1 from ‘std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>’ to ‘std::function<void(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>&&’ 404 | function(function&& __x) noexcept | ~~~~~~~~~~~^~~ /usr/include/c++/11/bits/std_function.h:386:7: note: candidate: ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = void; _ArgTypes = {std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >}]’ 386 | function(const function& __x) | ^~~~~~~~ /usr/include/c++/11/bits/std_function.h:386:32: note: no known conversion for argument 1 from ‘std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>’ to ‘const std::function<void(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>&’ 386 | function(const function& __x) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/11/bits/std_function.h:375:7: note: candidate: ‘std::function<_Res(_ArgTypes ...)>::function(std::nullptr_t) [with _Res = void; _ArgTypes = {std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >}; std::nullptr_t = std::nullptr_t]’ 375 | function(nullptr_t) noexcept | ^~~~~~~~ /usr/include/c++/11/bits/std_function.h:375:16: note: no known conversion for argument 1 from ‘std::_Bind<void (StudentNode::*(StudentNode*, int))(std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >)>’ to ‘std::nullptr_t’ 375 | function(nullptr_t) noexcept | ^~~~~~~~~ /usr/include/c++/11/bits/std_function.h:368:7: note: candidate: ‘std::function<_Res(_ArgTypes ...)>::function() [with _Res = void; _ArgTypes = {std::shared_ptr<std_msgs::msg::Float32MultiArray_<std::allocator<void> > >}]’ 368 | function() noexcept | ^~~~~~~~ /usr/include/c++/11/bits/std_function.h:368:7: note: candidate expects 0 arguments, 1 provided gmake[2]: *** [CMakeFiles/wang_node.dir/build.make:76:CMakeFiles/wang_node.dir/src/wang.cpp.o] 错误 1 gmake[1]: *** [CMakeFiles/Makefile2:137:CMakeFiles/wang_node.dir/all] 错误 2 gmake: *** [Makefile:146:all] 错误 2 --- Failed <<< class [2.95s, exited with code 2] Summary: 1 package finished [3.13s] 1 package failed: class 1 package had stderr output: class
09-21
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值