Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2023-02-19 23:08:45


Gavin Lambert wrote:
> (Also, can someone explain why x == y <==> y == x is controversial? I have a
> hard time picturing a use case where you deliberately intend these to be non-
> commutative, outside of pathological library-fights.)

Why is this "pathological"? If you allow heterogeneous comparisons, who
decides the meaning of x == y, the author of x or the author of y?

The unspoken convention in C++ is "the left hand decides". Because there
needs to be a convention.

Why the left hand side? Because (a) it's natural and (b) if you use member
operator==, that's what happens.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk