From 231273b130d4cc213158ce858262b7f1b7b6fcdd Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 28 Jun 2018 15:09:23 +0200 Subject: JSON: Add qHash functions for JSON and CBOR types This way we can easily use them as keys in QHash and QSet. Change-Id: Ie744c3b5ad1176ba2ab035c7e650af483757a0c9 Reviewed-by: Thiago Macieira --- src/corelib/tools/qhashfunctions.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h index e6ae7a0b85..d013c26d66 100644 --- a/src/corelib/tools/qhashfunctions.h +++ b/src/corelib/tools/qhashfunctions.h @@ -104,6 +104,11 @@ Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QBitArray &key, uint seed = Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(QLatin1String key, uint seed = 0) Q_DECL_NOTHROW; Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qt_hash(QStringView key, uint chained = 0) Q_DECL_NOTHROW; +Q_DECL_CONST_FUNCTION inline uint qHash(std::nullptr_t, uint seed = 0) Q_DECL_NOTHROW +{ + return qHash(reinterpret_cast(nullptr), seed); +} + template inline uint qHash(const T *key, uint seed = 0) Q_DECL_NOTHROW { return qHash(reinterpret_cast(key), seed); -- cgit v1.2.3