[Development] Should QVariant be doing fuzzy comparisons on doubles?
marc.mutz at kdab.com
Tue Sep 20 08:57:17 CEST 2016
On Monday 19 September 2016 23:27:52 Olivier Goffart wrote:
> On Montag, 19. September 2016 18:48:10 CEST Marc Mutz wrote:
> > 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.
> We really cannot have a qHash for QVariant anyway, because that would imply
> that ALL QVariant can be hashed, and compared. Which is not the case. Most
> custom types don't even register comparator function.
> So I don't think that's an argument.
We have a op== on QVariant, thus we must be able to have a qHash, but indeed,
as I said, this is an extensive amount of work, as if introducing comparator
functions from scratch.
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
KDAB - Qt, C++ and OpenGL Experts
More information about the Development