[Development] QVariant comparison in Qt6

Ville Voutilainen ville.voutilainen at gmail.com
Mon Sep 21 19:24:04 CEST 2020


On Sun, 20 Sep 2020 at 09:06, Thiago Macieira <thiago.macieira at intel.com> wrote:
> > You can't write a conversion from a type you don't own to an int, or
> > vice versa. Don't fall into that trap, it's impossible
> > to dig yourself out of it.
>
> Sorry, I don't understand the issue.
>
> I'm thinking of an internal function that is used to implement operator<=>
> (and if pre-C++20 support is desired, operator== and operator<).

My bad, I thought we're talking about an API-exposed function. But if
that's not the case, then it's even
less necessary to bother with conditionally using <compare>'s types,
and std::optional seems fine.
The functionality built on top of it can convert the optional into a
weak_ordering, as an optional
feature, rather than having the underlying private utility function
have multiple definitions or overloads
or whatever.


More information about the Development mailing list