From 871392790eafdd22521367ba485da5c10e9bb0db Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 11 Oct 2020 20:42:29 +0200 Subject: [PATCH] QOverload helpers: code tidies Remove pre-C++14 code paths; and mark as `inline` the qOverload helper objects (constexpr variables at namespace scope aren't automatically inline). Change-Id: Ieb2a9f06e39720d0c7215a3d1273c3a5996d0bc7 Reviewed-by: Volker Hilsheimer --- src/corelib/global/qglobal.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 3e32a4815a..a9b412b7b1 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1173,7 +1173,6 @@ Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1); #ifdef Q_QDOC - // Just for documentation generation template auto qOverload(T functionPointer); @@ -1181,9 +1180,7 @@ template auto qConstOverload(T memberFunctionPointer); template auto qNonConstOverload(T memberFunctionPointer); - -#elif defined(Q_COMPILER_VARIADIC_TEMPLATES) - +#else template struct QNonConstOverload { @@ -1225,12 +1222,9 @@ struct QOverload : QConstOverload, QNonConstOverload { return ptr; } }; -#if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 // C++14 -template [[maybe_unused]] constexpr QOverload qOverload = {}; -template [[maybe_unused]] constexpr QConstOverload qConstOverload = {}; -template [[maybe_unused]] constexpr QNonConstOverload qNonConstOverload = {}; -#endif - +template [[maybe_unused]] constexpr inline QOverload qOverload = {}; +template [[maybe_unused]] constexpr inline QConstOverload qConstOverload = {}; +template [[maybe_unused]] constexpr inline QNonConstOverload qNonConstOverload = {}; #endif