mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
slight change to how we declare our qHash overload for CValueObject,
which fixes some include order dependency shenanigans when compiling with GCC, which was caused by the requirement to overload qHash for CCollection and the way qHash interacts with the dreaded two-phase lookup for C++ templates refs #81
This commit is contained in:
@@ -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 <QtDBus/QDBusMetaType>
|
||||
#include <QString>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user