Robotics StackExchange | Archived questions

SharedPtr syntax differences to make it more readable

class RobotNewsStationNode: public rclcpp::Node
{
    public:
        RobotNewsStationNode() : Node("node_name")
        {

        }

    private:
        rclcpp::Publisher<example_interfaces::msg::String>::SharedPtr publisher_;
};

but when I hover over the private member I see

using
rclcpp::Publisher<example_interfaces::msg::String>::SharedPtr 
=
std::shared_ptr<rclcpp::Publisher<example_interfaces::msg::String>>

The explanation given by my instructor to use what I used in the class is that it's to make it more readable. But there's not much difference.
Which is preferred in actual projects?

Asked by nyck3333 on 2023-06-05 22:52:10 UTC

Comments

Answers