Boost logo

Boost :

From: Steven Robbins (steve_at_[hidden])
Date: 2023-02-20 23:01:14


On Monday, February 20, 2023 4:45:33 P.M. CST Andrey Semashev via Boost wrote:
> On 2/21/23 01:00, Gavin Lambert via Boost wrote:
> > On 21/02/2023 00:30, Andrey Semashev wrote:
> >> 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.
> >
> > No, I addressed that. Even in lambda libraries, operator== should be
> > used only for equivalence (as an indirection rather than directly), and
> > as such it should still be commutative and agnostic of specific order.
> > Assuming that, it shouldn't be broken by the C++20 changes.
>
> In template expressions, operators are generally not commutative because
> the type of the result depends on types of the left and right arguments.

Isn't the result of "==" always boolean?

I'm still having a hard time understanding in what "non pathological"
circumstances it makes sense for this operator NOT to be symmetric?

-Steve




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