aboutsummaryrefslogtreecommitdiff
path: root/lib/util.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-09-09 18:21:43 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-09-09 18:21:43 +0900
commit3b8cf1a5b1277b1df0981ee41d24d6b3dcea51e6 (patch)
treebfd6a2c7e707121c0f290d1698a82c12205954c7 /lib/util.h
parent0aa785e1bd0b421f3328f386a08a1fe83761d8e2 (diff)
downloadlibquotient-3b8cf1a5b1277b1df0981ee41d24d6b3dcea51e6.tar.gz
libquotient-3b8cf1a5b1277b1df0981ee41d24d6b3dcea51e6.zip
util.h: move qAsConst out of QMatrixClient
It's borrowed from Qt; namespacing basically forced client writers to put "using namespace QMatrixClient" before using qAsConst.
Diffstat (limited to 'lib/util.h')
-rw-r--r--lib/util.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/util.h b/lib/util.h
index ce166e35..13eec143 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -40,6 +40,15 @@
_ClassName(_ClassName&&) Q_DECL_EQ_DELETE; \
_ClassName& operator=(_ClassName&&) Q_DECL_EQ_DELETE;
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
+// Copy-pasted from Qt 5.10
+template <typename T>
+Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
+// prevent rvalue arguments:
+template <typename T>
+static void qAsConst(const T &&) Q_DECL_EQ_DELETE;
+#endif
+
namespace QMatrixClient
{
// The below enables pretty-printing of enums in logs
@@ -146,15 +155,6 @@ namespace QMatrixClient
template <typename FnT>
using fn_arg_t = typename function_traits<FnT>::arg_type;
-#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
- // Copy-pasted from Qt 5.10
- template <typename T>
- Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; }
- // prevent rvalue arguments:
- template <typename T>
- static void qAsConst(const T &&) Q_DECL_EQ_DELETE;
-#endif
-
inline auto operator"" _ls(const char* s, std::size_t size)
{
return QLatin1String(s, int(size));