From 38cfebc55c73c55f162871d013fa3db913f150ea Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Tue, 5 May 2015 00:05:10 +0100 Subject: [PATCH] refs #413 Fixed TupleHelper::hash() using the wrong overload of qHash() found by ADL. --- src/blackmisc/valueobject_private.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/blackmisc/valueobject_private.h b/src/blackmisc/valueobject_private.h index 5be7c865b..90a442560 100644 --- a/src/blackmisc/valueobject_private.h +++ b/src/blackmisc/valueobject_private.h @@ -57,13 +57,18 @@ namespace BlackMisc virtual void toIcon(const void *object, CIcon &o_icon) const = 0; }; - //! \private Fallback in case qHash is not defined for T. - template - uint qHash(const T &) { return 0; } - //! \private Fallback in case compare is not defined for T. - template - int compare(const T &, const T &) { return 0; } + //! \private + namespace Fallback + { + //! \private Fallback in case qHash is not defined for T. + template + uint qHash(const T &object) { return 0; } + + //! \private Fallback in case compare is not defined for T. + template + int compare(const T &a, const T &) { return 0; } + } //! \private Implementation of IValueObjectMetaInfo representing the set of operations supported by T. template @@ -111,6 +116,7 @@ namespace BlackMisc } virtual uint getValueHash(const void *object) const override { + using Private::Fallback::qHash; return qHash(cast(object)); } virtual int getMetaTypeId() const override @@ -124,6 +130,7 @@ namespace BlackMisc } virtual int compareImpl(const void *lhs, const void *rhs) const override { + using Private::Fallback::compare; return compare(cast(lhs), cast(rhs)); } virtual void setPropertyByIndex(void *object, const CVariant &variant, const CPropertyIndex &index) const override