[Development] Should QVariant be doing fuzzy comparisons on doubles?
olivier at woboq.com
Mon Sep 26 10:17:45 CEST 2016
On Montag, 26. September 2016 09:55:13 CEST Jędrzej Nowacki wrote:
> On fredag 23. september 2016 11.22.08 CEST Olivier Goffart wrote:
> > template<class T>
> > auto registerEqualityOperator()
> > -> decltype(std::declval<T>() == std::declval<T>())
> I have tried it already. Sadly it breaks terribly in case of
> private/protected operators.
It does not break. It will simply not be registered if it's private.
(It is a C++11 expression SFINAE in a decltype, not a &T::operator==
> It doesn't solve the problem, because types
> may got converted just to satisfy operator== type requirements.
That is indeed more of a problem. I think we can live with that.
> In addition it causes small perf problems.
Are you talking about the registration cost? If we register all at the same
time, I'd say that's negligible.
> So QVariant::operator== is broken and it is not fixable without _major_
Yes that's true.
Woboq - Qt services and support - https://woboq.com - https://code.woboq.org
More information about the Development