C++ 如何复制KD树CGAL

C++ 如何复制KD树CGAL,c++,pointers,copy-constructor,cgal,kdtree,C++,Pointers,Copy Constructor,Cgal,Kdtree,我是CGAL新手,我需要基于提供的点云构建一个动态数量的邻居搜索::树。以下是示例代码: typedef Neighbor_search::Tree SpatialTree; std::vector<SpatialTree> cloudTrees(pointCloudPath.size()); for(int i = 0; i < pointCloudPath.size(); i++) { readPLY(pointCloudPath.at(i),

我是CGAL新手,我需要基于提供的点云构建一个动态数量的邻居搜索::树。以下是示例代码:

typedef Neighbor_search::Tree SpatialTree; 

std::vector<SpatialTree> cloudTrees(pointCloudPath.size()); 

for(int i = 0; i < pointCloudPath.size(); i++) 
{ 
        readPLY(pointCloudPath.at(i), pointClouds.at(i));   
        SpatialTree cloudtree(pointClouds.at(i).begin(), pointClouds.at(i).end()); 
        cloudTrees.at(i) = cloud1tree; //error 
} 
typedef邻居搜索::树空间树;
向量云树(pointCloudPath.size());
对于(int i=0;i
我收到错误:“boost::mutex::operator=”:无法访问在类“boost::mutex”中声明的私有成员

我搜索过这个问题,似乎kd树中的复制构造函数是受保护的,类是不可复制的。我尝试使用指针,但我的问题是无法访问功能块之外的数据:

std::vector<SpatialTree*> cloudTrees(pointCloudPath.size()); 

for(int i = 0; i < pointCloudPath.size(); i++) 
{ 
        readPLY(pointCloudPath.at(i), pointClouds.at(i));   
        SpatialTree cloud1tree(pointClouds.at(i).begin(), pointClouds.at(i).end()); 
        cloudTrees.at(i) = &cloud1tree; 
}   

 //data in cloudTrees is not accessible 
std::向量云树(pointCloudPath.size());
对于(int i=0;i

请提供帮助,我如何在向量中复制树?

尝试类似于
cloudTrees[I].insert(pointClouds.at(I).begin(),pointClouds.at(I).end()的操作在您的循环中。@谢谢您的想法。我用数组改变了向量,插入了CyrdTrar值,它工作了:这是一个C++问题而不是CGAL问题。在第一种情况下,您需要:
std::vector cloudTrees;云杉保护区(…)
then
cloudTrees.emplace_back(pointClouds.at(i).begin(),pointClouds.at(i).end())。在第二种情况下,您需要
cloudTrees.at(i)=新的空间树(…)。嘿,马克,谢谢你的评论。cgal kd树中没有可用的公共复制构造函数。我只想提到:std::vector cloudTrees;在reserve之后,我得到错误:“CGAL::Kd_tree::Kd_tree”:无法访问在类“CGAL::Kd_tree”中声明的私有成员,在调整大小时,我得到的错误与我在问题中提到的相同。虽然使用第二种方法,在vector中添加元素,使用新的SpatialTree(…)初始化它,WordKeh,右边,KdTead是不可移动的(其析构函数也看起来可疑),因此它不能轻易地用在STD::向量(有可能在将来的C++修订中使之成为可能,但是还没有完成)。理想情况下,有人会让Kd_树可以移动。。。