summaryrefslogtreecommitdiffstats
path: root/src/concurrent/qtconcurrentfunctionwrappers.h
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2022-01-20 14:02:34 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2022-01-20 22:56:11 +0100
commit7f318327e57122c7f49bdef9915153f6956a5c7d (patch)
tree8a7db57fbfb530daf507a0bc370f12f9dc032778 /src/concurrent/qtconcurrentfunctionwrappers.h
parentd99714e3166dccbcbf5218325ce8c4da6070a68a (diff)
QtConcurrent: use variable templates for compile-time checks
Noticed during the API review. Pick-to: 6.3 6.2 Task-number: QTBUG-99883 Change-Id: I19571343a0cf0609beae2422ef1f69f7a34eb9ac Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/concurrent/qtconcurrentfunctionwrappers.h')
-rw-r--r--src/concurrent/qtconcurrentfunctionwrappers.h19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/concurrent/qtconcurrentfunctionwrappers.h b/src/concurrent/qtconcurrentfunctionwrappers.h
index 08966115d6d..e9154070bc8 100644
--- a/src/concurrent/qtconcurrentfunctionwrappers.h
+++ b/src/concurrent/qtconcurrentfunctionwrappers.h
@@ -142,24 +142,17 @@ struct ReduceResultType<T(C::*)(U) noexcept>
};
template<class T, class Enable = void>
-struct hasCallOperator : std::false_type
-{
-};
+inline constexpr bool hasCallOperator_v = false;
template<class T>
-struct hasCallOperator<T, std::void_t<decltype(&T::operator())>> : std::true_type
-{
-};
+inline constexpr bool hasCallOperator_v<T, std::void_t<decltype(&T::operator())>> = true;
template<class T, class Enable = void>
-struct isIterator : std::false_type
-{
-};
+inline constexpr bool isIterator_v = false;
template<class T>
-struct isIterator<T, std::void_t<typename std::iterator_traits<T>::value_type>> : std::true_type
-{
-};
+inline constexpr bool isIterator_v<T, std::void_t<typename std::iterator_traits<T>::value_type>> =
+ true;
template <class Callable, class Sequence>
using isInvocable = std::is_invocable<Callable, typename std::decay_t<Sequence>::value_type>;
@@ -180,7 +173,7 @@ struct ReduceResultTypeHelper<Callable,
template <class Callable>
struct ReduceResultTypeHelper<Callable,
typename std::enable_if_t<!std::is_function_v<std::remove_pointer_t<std::decay_t<Callable>>>
- && hasCallOperator<std::decay_t<Callable>>::value>>
+ && hasCallOperator_v<std::decay_t<Callable>>>>
{
using type = std::decay_t<typename QtPrivate::ArgResolver<Callable>::First>;
};