[ros-users] [Discourse.ros.org] [Next Generation ROS] RFC: using C++14

William Woodall ros.discourse at gmail.com
Thu Dec 8 20:45:25 UTC 2016

The second example (the one with `auto msg` in the lambda) is ambiguous, I think. What should the type of `msg` be? `std_msgs::msg::String::ConstSharePtr` or `std_msgs::msg::String::UniquePtr` or something else? I don't think the compiler can implicitly infer which type you mean in this situation.

What you're doing might work if you also supplied the `CallbackT` template argument to `create_subscription`.

I'll play around with the example and see if I can simplify it. It should be possible, in principle, to do implicit template specialization on the `create_subscription` method, such that you can drop the `<std_msgs::msg::String>` explicit template specialization. Then you'd just need to explicitly type the `msg` parameter to the lambda.

[Visit Topic](https://discourse.ros.org/t/rfc-using-c-14/921/10) or reply to this email to respond.

More information about the ros-users mailing list