C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Manifold comparison operator

From: Fabio Alemagna <falemagn_at_[hidden]>
Date: Tue, 26 Sep 2023 18:00:13 +0200
Il giorno mar 26 set 2023 alle ore 17:09 Lénárd Szolnoki via
Std-Proposals <std-proposals_at_[hidden]> ha scritto:
> > However, meanwhile I came up with a revised version that uses
> > policies
> > and free functions rather than subclasses, to achieve the same syntax
> > but with a leaner and more composable implementation.
> >
> > https://godbolt.org/z/4Wv7rq4se
>
> I don't know how to interpret `all_of(a, b) < any_of(c, d)` at a
> glance.
>
> Is this "for every x in {a, b} exists y in {c, d} so that x < y", or is

That's the correct mathematical translation, as far as I can tell, yes.

> it "there exists a y in {c, d} so that for every x in {a, b} x < y".

That would be the mathematical translation of

    any_of(c, d) > all_of(a, b)

> I think these two are probably equivalent if a,b,c,d have a total
> order, otherwise I don't think they necessarily are.

Indeed, but that depends on the type of the values being compared,
which I would expect the programmer to know.

Fabio

Received on 2023-09-26 16:00:28