我有一个包含许多成员的结构,还有一个 == 的运算符重载,如下所示:
struct Adjustment {
ObjectNumber aD;
Foo afoo;
bool operator == (const Adjustment& aAdjustment) const
{ return (aAdjustment.ID == ID); }
};
在代码中我有:
if(someAdjustment == NULL)
它给了我:
error C2678: binary '==' : no operator found which takes a left-hand operand of type 'Unit::Adjustment' (or there is no acceptable conversion)
所以我的问题是,如何在不更改其代码的情况下检查此结构是否已设置?