Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2023-02-20 11:30:13


On 2/20/23 08:47, Gavin Lambert via Boost wrote:
> On 20/02/2023 18:25, Peter Dimov wrote:
>> Whatever your definition of equivalence, X is neither equivalent to an
>> int,
>> nor to a 'none', and 'none' doesn't even have operator==.
>
> Regarding this point specifically, the author of X has indeed declared
> that X has an equivalence to int, by implementing that operator.
>
> Being able to ask if `x == 4` inherently implies that `x` can somehow be
> equivalent to `4`.  If that equivalence is not intended to be implied,
> then it shouldn't have been defined.  (or perhaps a different type from
> `int` should have been used)

I think you're missing the point that operator== isn't always used to
implement equivalence. This is also true wrt. other operators and their
default function. We have a number of lambda libraries in Boost, as well
as Boost.Proto and Boost.Spirit that wouldn't have existed if we
followed your logic.


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