diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-09-09 18:21:43 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-09-09 18:21:43 +0900 |
commit | 3b8cf1a5b1277b1df0981ee41d24d6b3dcea51e6 (patch) | |
tree | bfd6a2c7e707121c0f290d1698a82c12205954c7 /lib/util.h | |
parent | 0aa785e1bd0b421f3328f386a08a1fe83761d8e2 (diff) | |
download | libquotient-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.h | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -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)); |