summaryrefslogtreecommitdiffhomepage
path: root/compat/qhash.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'compat/qhash.hpp')
-rw-r--r--compat/qhash.hpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/compat/qhash.hpp b/compat/qhash.hpp
new file mode 100644
index 00000000..5286e97e
--- /dev/null
+++ b/compat/qhash.hpp
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <functional>
+
+#include <QtGlobal>
+#include <QString>
+#include <QHashFunctions>
+
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
+
+#include <cstdlib>
+
+namespace std {
+template<> struct hash<QString>
+{
+ using argument_type = QString;
+ using result_type = std::size_t;
+
+ std::size_t operator()(const QString& value) const noexcept
+ {
+ return (std::size_t) qHash(value);
+ }
+};
+}
+
+#endif