当我使用==
运算符编译器进行比较时,我有两个std :: array的大小相同并存储相同的元素类型(我写的类)抛出这个错误:...\include\xutility(2919): error C2672: 'operator __surrogate_func': no matching overloaded function found
。std :: array无法与我的类作为其元素的两个数组之间进行比较
我试着比较两个数组与向量作为他们的元素,它的工作原理但比较阵列与我写的任何类我得到的错误。
测试类:
class Class {
int i;
public:
Class() {}
Class(const Class& other) {}
Class(Class&& other) {}
~Class() {}
Class operator= (const Class& other) {}
Class operator= (Class&& other) {}
BOOL operator== (const Class& other) {}
};
比较:
std::array<Class, 3> a0 = {};
std::array<Class, 3> a1 = {};
if (a0 == a1)
"COOL";
错误我越来越:
...\include\xutility(2919): error C2672: 'operator __surrogate_func': no matching overloaded function found
为什么要退'BOOL'而不是'布尔“,为什么你的函数没有返回声明? – krzaq
因为你没有比较'a0'和'a1',而是数组。 –
@Eli Sadoff a1和a0是数组lol –