私は2つのstd :: array同じサイズを持っていて、同じ要素の型(私が書いたクラス)を格納するのは==
演算子コンパイラこのエラーが発生します:...\include\xutility(2919): error C2672: 'operator __surrogate_func': no matching overloaded function found
。std :: array私のクラスを要素として持つ2つの配列を比較できません
私はベクトルを要素としてトウ配列を比較しようとしましたが、それは機能しましたが、どのクラスでも配列を比較するとエラーが発生します。
Testクラス:
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'を返す代わりにされていますなぜあなたの関数にreturn文がありませんか? – krzaq
あなたは 'a0'と' a1'を比較するのではなく、配列を比較しているからです。 –
@ El Sadoff a1とa0は配列Lol –