the problem is you cannot do this:
std::vector<pcl::PointXYZ> data ;
because PointXYZ type is a vector of size 3 (x,y,z), you would need a matrix to save a bunch o pointXYZs.
but if you want to save the points you can use a for loop.
for (int i=0; i < cloud.size()); i++)
{
vector[0] = cloud.points[i].x;
vector[1] = cloud.points[i].y;
vector[2] = cloud.points[i].z;
}
if you want to define a point and assign it with values do this:
pcl::PointXYZ point;
because the definition is :
pcl::PointXYZ::PointXYZ (
float _x,
float _y,
float _z
)