diff --git a/src/blackmisc/valueobject.cpp b/src/blackmisc/valueobject.cpp index 0376ac525..0fd03beb2 100644 --- a/src/blackmisc/valueobject.cpp +++ b/src/blackmisc/valueobject.cpp @@ -175,8 +175,3 @@ namespace BlackMisc return argument; } } - -uint qHash(const BlackMisc::CValueObject &value) -{ - return value.getValueHash(); -} diff --git a/src/blackmisc/valueobject.h b/src/blackmisc/valueobject.h index 0e8b2be6d..d38072bbd 100644 --- a/src/blackmisc/valueobject.h +++ b/src/blackmisc/valueobject.h @@ -1,19 +1,6 @@ #ifndef BLACKMISC_VALUEOBJECT_H #define BLACKMISC_VALUEOBJECT_H -namespace BlackMisc -{ - class CValueObject; -} - -/*! - * qHash overload, needed for storing CValueObject in a QSet. - * \param value - * \return - */ -// Appears before all #include directives, to workaround an issue with GCC where the overload is not visible in QSet -unsigned int qHash(const BlackMisc::CValueObject &value); - #include "blackmisc/debug.h" #include #include @@ -364,6 +351,22 @@ namespace BlackMisc return variant != uc; } + /*! + * qHash overload, needed for storing CValueObject in a QSet. + * \param value + * \param seed + * \return + */ + inline uint qHash(const BlackMisc::CValueObject &value, uint seed = 0) + { + return ::qHash(value.getValueHash(), seed); + } + + // Needed so that our qHash overload doesn't hide the qHash overloads in the global namespace. + // This will be safe as long as no global qHash has the same signature as ours. + // Alternative would be to qualify all our invokations of the global qHash as ::qHash. + using ::qHash; + } // namespace #endif // guard