From 3b8cf1a5b1277b1df0981ee41d24d6b3dcea51e6 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 9 Sep 2018 18:21:43 +0900 Subject: 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. --- lib/util.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/util.h') 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 +Q_DECL_CONSTEXPR typename std::add_const::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; } +// prevent rvalue arguments: +template +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 using fn_arg_t = typename function_traits::arg_type; -#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0) - // Copy-pasted from Qt 5.10 - template - Q_DECL_CONSTEXPR typename std::add_const::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; } - // prevent rvalue arguments: - template - 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)); -- cgit v1.2.3