I noticed that the any_subscription_callback supports shared_ptr and unique_ptr, but not const&: https://github.com/ros2/rclcpp/blob/master/rclcpp/include/rclcpp/any_subscription_callback.hpp. It seems simpler to have const& on the subscription callback. The user almost always uses the data in the callback scope. Generally, he will not change the owner of the message data to avoid copying. The rclpcc example should use it: https://github.com/ros2/examples/blob/master/rclcpp_examples/src/topics/listener.cpp.