diff options
Diffstat (limited to 'src/corelib/text/qchar.h')
-rw-r--r-- | src/corelib/text/qchar.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/corelib/text/qchar.h b/src/corelib/text/qchar.h index fb358ba8be..8a616b4c73 100644 --- a/src/corelib/text/qchar.h +++ b/src/corelib/text/qchar.h @@ -42,6 +42,8 @@ #include <QtCore/qglobal.h> +#include <functional> // for std::hash + QT_BEGIN_NAMESPACE @@ -664,4 +666,17 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QChar &); QT_END_NAMESPACE +namespace std { +template <> +struct hash<QT_PREPEND_NAMESPACE(QChar)> +{ + template <typename = void> // for transparent constexpr tracking + constexpr size_t operator()(QT_PREPEND_NAMESPACE(QChar) c) const + noexcept(noexcept(std::hash<char16_t>{}(u' '))) + { + return std::hash<char16_t>{}(c.unicode()); + } +}; +} // namespace std + #endif // QCHAR_H |