C++ list remove 方法的错误C2678

来源:互联网 发布:淘宝极速退款 编辑:程序博客网 时间:2024/06/10 21:11

对于list的元素是自己定义的类的话,如果类中没有定义操作符==的话容易出现这个错误,自己的类中定义操作符的方法为:

class juxing
{
public :
int length;
int width;
public:
juxing()
{


}
juxing(int a,int b)
{
length = a;
width = b;
}
inline bool operator == (const juxing &ps) const
{
if (this->length == ps.length && this->width == ps.width)
return true;
return false;
}
};
原创粉丝点击