summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-01-03 13:58:30 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-01-03 14:35:55 +0100
commitcbaafb9a828f13abb55b99f8f2c4caa2337ef9e9 (patch)
tree24ca91194b7f66b6caff05b146249d75512d87d7
parentc248b83845e0ad07de6e2e9b433b161a87197b38 (diff)
compat/util: add string literal operator
It's unused, but useful for embedded .text section literals with unlimited lifetime.
-rw-r--r--compat/string-literal-operator.hpp9
-rw-r--r--compat/util.hpp1
2 files changed, 10 insertions, 0 deletions
diff --git a/compat/string-literal-operator.hpp b/compat/string-literal-operator.hpp
new file mode 100644
index 00000000..3ea4eb11
--- /dev/null
+++ b/compat/string-literal-operator.hpp
@@ -0,0 +1,9 @@
+#pragma once
+
+#include <QLatin1String>
+#include <cstddef>
+
+static inline constexpr auto operator"" _qstr(const char* str, std::size_t N)
+{
+ return QLatin1String(str, str + N);
+}
diff --git a/compat/util.hpp b/compat/util.hpp
index a1976e35..f679afcf 100644
--- a/compat/util.hpp
+++ b/compat/util.hpp
@@ -3,6 +3,7 @@
#include "opentrack-library-path.h"
#include "ndebug-guard.hpp"
#include "run-in-thread.hpp"
+#include "string-literal-operator.hpp"
#include "meta.hpp"
#include "functional.hpp"
#include "macros.hpp"