C++ Logo

std-proposals

Advanced search

Re: nullptr_t and nullopt_t should both have operator<=> and operator== to enable the *_with concepts

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Sat, 10 Jul 2021 00:36:28 +0300
On Sat, 10 Jul 2021 at 00:20, Barry Revzin <barry.revzin_at_[hidden]> wrote:
> Yeah, but it's constructible, assignable, and comparable... which, as people often tell me, should actually mean that they're "the same."

I would love to see an actual pros/cons analysis taking into account
practical impact on programs, rather than
go with something like "because a particular definition of 'regular'
interpreted in a particular way says 'these are actually the same
type'".

> Also, these functions could easily be provided to just be: false, UB, throw, and just return the provided argument, accordingly.

Right. Provide an operator* that can only ever be used in an
unevaluated context, and thus fails to actually fulfil any meaningful
contract that can reasonable expected from an operator*. Doesn't sound
regular at all, by any definition I can imagine, as the
type doesn't model the possible underlying concept of a nullable
handle. Same goes for those other functions, albeit less severely.

Received on 2021-07-09 16:36:43