[Interest] QVariant compare operator
Matthew Woehlke
mwoehlke.floss at gmail.com
Mon Apr 20 16:04:38 CEST 2020
On 19/04/2020 08.23, André Pönitz wrote:
> QVariant(TypeA) and QVariant(TypeB) can be ordered for different TypeA and
> TypeB based e.g. on alphabetical order of their .typeName().
>
> If wanted, this can be refined to make e.g. all integral types comparable.
No:
int{5} <=> JsonObject{...} => lesser
int{5} <=> long{3} => greater
long{3} <=> JsonObject{...} => greater
...oops.
You'd have to make all integral types sort before (or after) all other
types, but then you're back to not having a reliable ordering by type name.
It makes *much* more sense that some comparisons just come back
"incomparable".
--
Matthew
More information about the Interest
mailing list