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++;
}
}
}
Error message reads:
Severity Code Description Project File Line Error C3867 'std::_Iterator_base12::_Getcont': non-standard syntax; use '&' to create a pointer to member
What does this mean? How can I fix this? Am I not using this iterator schema correctly? I'm attempting to access these elements.
You're trying to use the function std::vector<cv::Point3d>::iterator::_Getcont
without calling it ( ()
) or using address-of syntax ( &
), which is indeed non-standard.
cv::Point3d thisOne = col._Getcont();
However, this function is from the internals of Visual Studio's standard library implementation (the leading _
and the lack of a mention in cppreference.com's documentation of the public interface for RandomAccessIterator s being the main clues); I have no idea why you're trying to use it. Just dereference the iterator, like everyone else:
const cv::Point3d& thisOne = *col;
Since col
is a std::vector<cv::Point3d>::iterator
you would have to access an attribute from the Point3d
using
cv::Point3d thisOne = col->_Getcont;
and if this is a method, make sure you actually call the method
cv::Point3d thisOne = col->_Getcont();
Should not you use?
cv::Point3d thisOne = col->_Getcont;
Or if _Getcont is a member function
cv::Point3d thisOne = col->_Getcont();
Or
cv::Point3d thisOne = ( *col )._Getcont;
cv::Point3d thisOne = ( *col )._Getcont();
Or maybe you could write simply
cv::Point3d thisOne = *col;
because the type of the left object is the same as the type of expression *col
.
In this case the function could be written like
void PointCloud::Create(std::vector<std::vector<cv::Point3d>> threeDPointSpace)
{
for ( auto &row : threeDPointSpace )
{
for ( auto &thisOne : row )
{
vertices.push_back(VertexFormat(glm::vec3(thisOne.x, thisOne.y, thisOne.z), glm::vec4(1.0, 0.0, 1.0, 1.0)));
totalData++;
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.