我有一个名为 Point 的类(在外部库中,我无法修改代码),用于表示 3d 空间中的点:
int x = 0; int y = 0; int z = 0;
Point my_point p(x,y,z);
它重载了==
and!=
运算符,但不重载<
or >
。我需要以有效的方式存储它们(没有双重元素,没有重复)。我以为我的数据结构是set
,但如果我尝试使用,我会收到此错误:
error: no match for ‘operator<’ in ‘__x < __y’
一些忠告?