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 <volker.hilsheimer@qt.io>
This commit is contained in:
parent
79889a91a1
commit
871392790e
@ -1173,7 +1173,6 @@ Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1);
|
||||
|
||||
|
||||
#ifdef Q_QDOC
|
||||
|
||||
// Just for documentation generation
|
||||
template<typename T>
|
||||
auto qOverload(T functionPointer);
|
||||
@ -1181,9 +1180,7 @@ template<typename T>
|
||||
auto qConstOverload(T memberFunctionPointer);
|
||||
template<typename T>
|
||||
auto qNonConstOverload(T memberFunctionPointer);
|
||||
|
||||
#elif defined(Q_COMPILER_VARIADIC_TEMPLATES)
|
||||
|
||||
#else
|
||||
template <typename... Args>
|
||||
struct QNonConstOverload
|
||||
{
|
||||
@ -1225,12 +1222,9 @@ struct QOverload : QConstOverload<Args...>, QNonConstOverload<Args...>
|
||||
{ return ptr; }
|
||||
};
|
||||
|
||||
#if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 // C++14
|
||||
template <typename... Args> [[maybe_unused]] constexpr QOverload<Args...> qOverload = {};
|
||||
template <typename... Args> [[maybe_unused]] constexpr QConstOverload<Args...> qConstOverload = {};
|
||||
template <typename... Args> [[maybe_unused]] constexpr QNonConstOverload<Args...> qNonConstOverload = {};
|
||||
#endif
|
||||
|
||||
template <typename... Args> [[maybe_unused]] constexpr inline QOverload<Args...> qOverload = {};
|
||||
template <typename... Args> [[maybe_unused]] constexpr inline QConstOverload<Args...> qConstOverload = {};
|
||||
template <typename... Args> [[maybe_unused]] constexpr inline QNonConstOverload<Args...> qNonConstOverload = {};
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user