What's the difference between PointCloudConstPtr and PointCloud::ConstPtr
In subscriber callbacks our software stack uses a mixture of two function signatures. In the case of subscribing to a sensor_msgs::PointCloud, we use the following two signatures:
void callback(const sensor_msgs::PointCloud::ConstPtr& msg)
void callback(const sensor_msgs::PointCloudConstPtr& msg)
These are both defined in the autogenerated header PointCloud.h
template <class ContainerAllocator>
struct PointCloud_
{
// ---- Snip ----
typedef boost::shared_ptr< ::sensor_msgs::PointCloud_<ContainerAllocator> const> ConstPtr;
};
typedef ::sensor_msgs::PointCloud_<std::allocator<void> > PointCloud;
typedef boost::shared_ptr< ::sensor_msgs::PointCloud > PointCloudPtr;
typedef boost::shared_ptr< ::sensor_msgs::PointCloud const> PointCloudConstPtr;
Expanding the typedefs myself, I get the following
sensor_msgs::PointCloud::ConstPtr
boost::shared_ptr< ::sensor_msgs::PointCloud_<ContainerAllocator> const>
sensor_msgs::PointCloudConstPtr
boost::shared_ptr< ::sensor_msgs::PointCloud_<std::allocator<void> > const>
It's not clear to me what ContainerAllocator gets set to in case 1, and I'm also not sure what the purpose of ContainerAllocater is. Why would I choose one incantation over the other?