Boost logo

Boost :

From: Gavin Lambert (boost_at_[hidden])
Date: 2023-02-20 05:47:26


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)

This does *not* mean that an X is-a int, or even that it can be
converted from or to an int -- those are separate operations. But it is
-- somehow -- able to answer if it is currently equivalent to an int or
not. That is precisely what defining the operator means.


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