how*_*cow 1 c++ pointers iterator
void PointCloud::Create(std::vector<std::vector<cv::Point3d>> threeDPointSpace){
std::vector<std::vector<cv::Point3d>>::iterator row;
std::vector<cv::Point3d>::iterator col;
for (row = threeDPointSpace.begin(); row != threeDPointSpace.end(); row++) {
for (col = row->begin(); col != row->end(); col++) {
cv::Point3d thisOne = col._Getcont; // error reported here
vertices.push_back(VertexFormat(glm::vec3(thisOne.x, thisOne.y, thisOne.z), glm::vec4(1.0, 0.0, 1.0, 1.0)));
totalData++;
}
}
}
Run Code Online (Sandbox Code Playgroud)
错误消息显示:
严重级代码描述项目文件行错误C3867'std :: _ Iterator_base12 :: _ Getcont':非标准语法; 使用'&'创建指向成员的指针
这是什么意思?我怎样才能解决这个问题?我没有正确使用此迭代器架构吗?我正在尝试访问这些元素.
您正在尝试使用该函数std::vector<cv::Point3d>::iterator::_Getcont而不调用它(())或使用address-of syntax(&),这确实是非标准的.
cv::Point3d thisOne = col._Getcont();
Run Code Online (Sandbox Code Playgroud)
但是,这个函数来自Visual Studio的标准库实现的内部结构(_在cppreference.com的文档中,提到了RandomAccessIterator的公共接口的主要线索和缺点); 我不知道你为什么要使用它.只需取消引用迭代器,就像其他人一样:
const cv::Point3d& thisOne = *col;
Run Code Online (Sandbox Code Playgroud)