diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 1c28791d743..1e327b4e5b1 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -1380,6 +1380,9 @@ private: template using if_heterogeneously_seachable = QHashPrivate::if_heterogeneously_seachable_with; + template + using if_key_constructible_from = std::enable_if_t, bool>; + public: template = true> bool remove(const K &key) @@ -1417,7 +1420,7 @@ public: else return defaultValue; } - template = true> + template = true, if_key_constructible_from = true> T &operator[](const K &key) { return operatorIndexImpl(key); @@ -2389,6 +2392,9 @@ private: template using if_heterogeneously_seachable = QHashPrivate::if_heterogeneously_seachable_with; + template + using if_key_constructible_from = std::enable_if_t, bool>; + public: template = true> qsizetype remove(const K &key) @@ -2423,7 +2429,7 @@ public: else return defaultValue; } - template = true> + template = true, if_key_constructible_from = true> T &operator[](const K &key) { return operatorIndexImpl(key);