[Interest] QVariant compare operator

André Pönitz apoenitz at t-online.de
Sun Apr 19 13:05:05 CEST 2020


On Sat, Apr 18, 2020 at 09:44:40PM -0300, Thiago Macieira wrote:
> On Saturday, 18 April 2020 12:57:55 -03 Giuseppe D'Angelo via Interest wrote:
> > I guess that's the reason for dropping the comparisons in 6.0 and,
> > eventually, reintroduce it in 7.0. With the hope that we've learned the
> > lesson and proceed at _specifying_ the behaviour before implementing it.
> 
> Indeed, and implement the QVariant comparator on top of each underlying type's 
> spaceship operator. That way, we could order elements of the same type. For 
> mismatched types, QVariant can return std::partial_ordering::unordered.
>
> We can't do that right now because we can't rely on C++20. In fact, no current 
> compiler supports the spaceship operator. So that has to be Qt 7.

How comes the spaceship operator comes into play here?

It's syntactical sugar and in some cases an optimization, but has no concepual
powers exceeding those of operator<().

> For now, the feature is badly implemented and yet too many people are using 
> it.

Right.

> We can't simply remove it without giving fair warning. The warning is given.

Andre'


More information about the Interest mailing list