[英]Member reference base type 'Point *' is not a structure or union?
class Point {
public:
Point() : m_w(1) {}
Point(uint32_t i, uint32_t j, double_t v) : m_i(i), m_j(j), m_v(v), m_w(1) {}
double_t m_i;
double_t m_j;
double_t m_v;
double_t m_w;
};
void Cz_Image_Processing::doSomethingWithCameras()
{
std::vector<double> v;
std::vector<Point*> v_error;
Point *error_plane = new Point;
// for different loop , different error and plane
file_stream1 << plane << "," << error << std::endl;
error_plane->m_i = error;
error_plane->m_j = plane;
v_error.push_back(error_plane);
auto min = std::min_element(v_error.begin(), v_error.end(),
[](const Point *a, const Point *b)
{
return (a->m_i < b->m_i);
});
std::cout << min->m_i; // error -Member reference base type 'Point *' is not a structure or union?
}
My question is -我的问题是——
I was trying to find the minimum error and also the plane associated with it- but while trying to do it it is showing the reference based type is not structure or union.我试图找到最小错误以及与之相关的平面 - 但在尝试这样做时它显示基于引用的类型不是结构或联合。 I have read all the related answer but could not find the error.
我已阅读所有相关答案,但找不到错误。
It looks like std::min_element()
returns an iterator to the min element.看起来
std::min_element()
返回一个迭代器到 min 元素。 You should try something like: (*min)->m_i
.您应该尝试以下操作:
(*min)->m_i
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.