title: Create a pcl::PointCloud::Ptr from a pcl::PointCloud
body: <p>I would like to know if this is possible. I have a function:</p>
  
  <pre><code> pcl::PointCloud&lt;pcl::PointXYZRGB&gt; createPointCloud(std::Vector&lt;Nodes&gt; input)
  </code></pre>
  
  <p>which returns a point cloud. I would like to know if it is possible to take this point cloud, and make a pointer to a copy of it. pcl makes pointers to clouds like this:</p>
  
  <pre><code>pcl::PointCloud&lt;pcl::PointXYZRGB&gt;::Ptr cloudPTR(new pcl::PointCloud&lt;pcl::PointXYZRGB&gt;)
  </code></pre>
  
  <p>I have tried doing this:</p>
  
  <pre><code>pcl::PointCloud&lt;pcl::PointXYZRGB&gt;::Ptr cloudPTR(createPointCloud(nodeList))
  </code></pre>
  
  <p>This results in a pretty obvious error ie. createPointCloud doesnt return a pointer to a cloud. </p>
  
  <p>I have also tried this:</p>
  
  <pre><code>pcl::PointCloud&lt;pcl::PointXYZRGB&gt;::Ptr cloudPTR = &amp;createPointCloud(nodeList)
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>pcl::PointCloud&lt;pcl::PointXYZRGB&gt;::Ptr cloudPTR(&amp;createPointCloud(nodeList))
  </code></pre>
  
  <p>And this results in the compile error: "taking address of temporary"</p>
  
  <p>Is the only option to have the function return a pointer type or is there a way to do what i am asking?</p>
  
  <p>EDIT:</p>
  
  <p>Both of the below answers are correct, I have awarded Jonathon the correct tick as he got in first this time. </p>