On Mon, Apr 20, 2020 at 10:04:38AM -0400, Matthew Woehlke wrote: > 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.
"make comparable" means lumping them into a common "type", say "@integral", with values covering the union set of the values of the original type. int{5} == "@integral"{5} <=> JsonObject{...} => lesser int{5} == "@integral"{5} <=> "@integral{3}" == long{3} => greater long{3} == "@integral"{3} <=> JsonObject{...} => lesser! // not greater > 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. No. > It makes *much* more sense that some comparisons just come back > "incomparable". Possible, but not needed on the type level, and restricts use unnecessarily. Andre' _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest