[Interest] QVariant compare operator
Thiago Macieira
thiago.macieira at intel.com
Sun Apr 19 17:38:45 CEST 2020
On Sunday, 19 April 2020 08:05:05 -03 André Pönitz wrote:
> > 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<().
It's an optimisation: the QMetaType vtable for the type can contain a single
entry (spaceship) instead of one for equality and one for ordering. In
addition, we can determine how the element can compare by inspecting the
return type.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel System Software Products
More information about the Interest
mailing list