This might read cleaner if written using `make_shared()`:

    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_ptr = cloud.make_shared();

In fact, since you only use it once, you can just put the `cloud.make_shared()` call in-line where needed.