title: PCL How to create a Point Cloud array/vector?
body: <p>I have stored 85 Point Clouds on hdd. I want to open all the clouds and save them in a vector/array.<br>
  How should I do this?  </p>
  
  <p>What I tested with no success:  </p>
  
  <pre><code>    define _CRT_SECURE_NO_WARNINGS
      #include &lt;pcl/io/pcd_io.h&gt;
      #include &lt;pcl/point_types.h&gt;
      #include &lt;pcl/registration/icp.h&gt;
      #include &lt;pcl/visualization/pcl_visualizer.h&gt;
      #include &lt;pcl/common/transforms.h&gt;
      #include &lt;pcl/filters/voxel_grid.h&gt;
      #include &lt;pcl/filters/radius_outlier_removal.h&gt;
  
      #include &lt;Eigen/Geometry&gt;
  
  
      #include &lt;iostream&gt;
      #include &lt;string&gt;
  
      using namespace pcl;
      using namespace std;
  
      int main(int argc, char** argv)
      {
      //Create Point Clouds
      PointCloud&lt;PointXYZ&gt;::Ptr sourceCloud(new PointCloud&lt;PointXYZ&gt;);
  
      vector &lt; PointCloud&lt;PointXYZ&gt;::Ptr, Eigen::aligned_allocator &lt;PointCloud &lt;PointXYZ&gt;::Ptr &gt; &gt; sourceClouds;
  
      //save PointClouds to array
      for (int i = 1; i &lt; (argc - 1); i++)
      {
          if (io::loadPCDFile&lt;PointXYZ&gt;(argv[i], *sourceCloud) != 0)
          {
              return -1;
          }
          cout &lt;&lt; "Loaded file " &lt;&lt; argv[i] &lt;&lt; " (" &lt;&lt; sourceCloud-&gt;size() &lt;&lt; " points)" &lt;&lt; endl;
          sourceClouds.push_back(sourceCloud);
          cout &lt;&lt; "Point Cloud " &lt;&lt; i-1 &lt;&lt; "has got " &lt;&lt; sourceClouds[i-1]-&gt;size() &lt;&lt; " Points" &lt;&lt; endl;
          sourceCloud-&gt;clear();
      }
  
      for (int i = 0; i &lt; sourceClouds.size() - 1; i++)
      {
          cout &lt;&lt; "Point Cloud " &lt;&lt; i &lt;&lt; "has got " &lt;&lt; sourceClouds[i]-&gt;size() &lt;&lt; " Points" &lt;&lt; endl;
      }
      }
  </code></pre>
  
  <p>In the first for loop, the PointCloudSize from both Clouuds are the same, but in the second for loop, the PointCloudSize is 0.<br>
  What I'am doing wrong?</p>