difference between the 2 constructors
What is the difference between the 2 pieces of code -
tf2_ros::Buffer buffer(ros::Duration(10));
costmap_2d::Costmap2DROS costmap_one("costmap_one", buffer);
and
costmap_2d::Costmap2DROS *costmap_one = new costmap_2d::Costmap2DROS("costmap_one", buffer)
I understand that in the first case, we get a costmap2d::Costmap2DROS object named costmapone whereas in the second case, we get a pointer named costmapone that points to a costmap2d::Costmap2DROS object.
When should we use one over the other?
Asked by skpro19 on 2021-04-02 16:58:55 UTC
Comments
This is more of a general C++ programming question than anything specifically related to costmaps or ROS. What you're really asking is when to use stack versus heap memory - which you can google and determine with that more general question!
Asked by stevemacenski on 2021-04-02 18:21:32 UTC