我这个帖子,我看过这个:
class MonitorObjectString: public MonitorObject {
// some other declarations
friend inline bool operator==(/*const*/ MonitorObjectString& lhs,
/*const*/ MonitorObjectString& rhs)
{ return lhs.fVal==rhs.fVal; }
}
在我们继续之前,这非常重要:
- 我不是在质疑任何人的编码能力。
- 我只是想知道为什么有人在比较中需要非常量引用。
- 该问题的发布 者没有编写该代码。
这是以防万一。这也很重要:
- 我添加了
/*const*/
s 并重新格式化了代码。
现在,我们回到主题:
我想不出一个可以让您修改其按引用参数的等式运算符的合理使用。你?