0
我得到以下编译错误:C++模板类的编译错误
main.cc: In function 'int main(int, char**)':¶
main.cc:200: error: no match for 'operator==' in 'rt1 == rt2'¶
triple.hh:124: note: candidates are: bool Triple<T1, T2, T3>::operator==(const Triple<T1,T2, T3>&) [with T1 = int, T2 = int, T3 = int] <near match>¶
main.cc:27: note: bool operator==(const Special&, const Special&)¶
虽然我已经实现了==操作符重载我的模板类,如下所示:
bool operator==(const Triple<T1, T2, T3>& another) {
return (a == another.first() and b == another.second() and c == another.third());
}
对于我的模板类:
template <typename T1, typename T2, typename T3>
class Triple
你知道这个问题可能是什么吗?非常感谢。
什么是'特殊'类? – interjay
'rt1'和'rt2'的类型是什么? – ecatmur