[Development] Should QVariant be doing fuzzy comparisons on doubles?
Marc Mutz
marc.mutz at kdab.com
Mon Sep 19 18:48:10 CEST 2016
On Monday 19 September 2016 18:20:48 Thiago Macieira wrote:
> Should we do fuzzy comparisns in QVariant?
If you talk about op==, then using fuzzy compare is a definite no-no, because
it makes it impossible to define a hash function.
Fuzzy comparision should be performed with a named function, qFuzzyCompare,
and _only_ with that function.
We need to fix other classes for Qt 6, too (e.g. Q(Size|Point|Line)F.
That said, a qFuzzyCompare(QVariant, QVariant) would probably be useful, but
requires extensive extra work, like hashing a QVariant, too.
Thanks,
Marc
--
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - Qt, C++ and OpenGL Experts
More information about the Development
mailing list