C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Let spaceship return an int

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 27 Sep 2023 20:02:05 -0700
On Wednesday, 27 September 2023 18:42:28 PDT Jason McKesson via Std-Proposals
wrote:
> > Trying to convey the ordering category of a type? There are static
> > solutions (a return type), and there are dynamic solutions. An enum here
> > doesn't help where the category may change dynamically.
> The category changing dynamically (at runtime) makes absolutely no
> sense. The meaning of a comparison is not part of the value of an
> object.

A type that could have had category change dynamically is std::any. But just
like QVariant, std::any cannot be ordered. In fact, std::any isn't comparable
for equality at all (but QVaraint still is).

Dynamic typing doesn't lend itself ordering. What comes first, 0, NaN, nullptr,
the empty string, or an empty hash map?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-09-28 03:02:06