summaryrefslogtreecommitdiffstats
path: root/src/concurrent
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2021-07-10 20:57:03 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2021-07-21 09:46:33 +0200
commit6ebe3d0f0806069f906522dfe9b81baa3f3478de (patch)
treeabf147001a9018a6f85d86a50c36a4f27f6c3eb7 /src/concurrent
parent1dcfb09c5bf431bf8b065ac038bd1fc618a68f96 (diff)
Fix QtConcurrent to properly work with functors
QtConcurrent reduce functions were requiring to explicitly pass the the result type when passing functors as reductor. This was because of inability to deduce the result type from the functors. The result type of the QtConcurrent reduce functions should match with the type of the fist argument of the operator() when a functor is passed. Reused the ArgResolver type trait (already used for QFuture and QtConcurrent::run) to find out the result type in that case. Task-number: QTBUG-88448 Change-Id: Ief0eeee197df8cb9c30f3403d71978f36e4fb0f2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/concurrent')
-rw-r--r--src/concurrent/qtconcurrentfilter.h58
-rw-r--r--src/concurrent/qtconcurrentfunctionwrappers.h45
-rw-r--r--src/concurrent/qtconcurrentmap.h69
3 files changed, 101 insertions, 71 deletions
diff --git a/src/concurrent/qtconcurrentfilter.h b/src/concurrent/qtconcurrentfilter.h
index 891eb4b9ca..dce4f35db6 100644
--- a/src/concurrent/qtconcurrentfilter.h
+++ b/src/concurrent/qtconcurrentfilter.h
@@ -148,8 +148,8 @@ QFuture<ResultType> filteredReduced(Sequence &&sequence,
#ifndef Q_CLANG_QDOC
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ std::enable_if_t<QtPrivate::isInvocable<KeepFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
QFuture<ResultType> filteredReduced(QThreadPool *pool,
Sequence &&sequence,
KeepFunctor &&keep,
@@ -163,8 +163,8 @@ QFuture<ResultType> filteredReduced(QThreadPool *pool,
}
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ std::enable_if_t<QtPrivate::isInvocable<KeepFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
QFuture<ResultType> filteredReduced(Sequence &&sequence,
KeepFunctor &&keep,
ReduceFunctor &&reduce,
@@ -177,9 +177,9 @@ QFuture<ResultType> filteredReduced(Sequence &&sequence,
}
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
typename InitialValueType,
+ std::enable_if_t<QtPrivate::isInvocable<KeepFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
QFuture<ResultType> filteredReduced(QThreadPool *pool,
Sequence &&sequence,
@@ -196,9 +196,9 @@ QFuture<ResultType> filteredReduced(QThreadPool *pool,
}
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
typename InitialValueType,
+ std::enable_if_t<QtPrivate::isInvocable<KeepFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
QFuture<ResultType> filteredReduced(Sequence &&sequence,
KeepFunctor &&keep,
@@ -287,8 +287,7 @@ QFuture<ResultType> filteredReduced(Iterator begin,
#ifndef Q_CLANG_QDOC
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
QFuture<ResultType> filteredReduced(QThreadPool *pool,
Iterator begin,
Iterator end,
@@ -302,8 +301,7 @@ QFuture<ResultType> filteredReduced(QThreadPool *pool,
}
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
QFuture<ResultType> filteredReduced(Iterator begin,
Iterator end,
KeepFunctor &&keep,
@@ -317,8 +315,7 @@ QFuture<ResultType> filteredReduced(Iterator begin,
}
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
QFuture<ResultType> filteredReduced(QThreadPool *pool,
@@ -336,8 +333,8 @@ QFuture<ResultType> filteredReduced(QThreadPool *pool,
}
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
+ std::enable_if_t<QtPrivate::isIterator<Iterator>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
QFuture<ResultType> filteredReduced(Iterator begin,
@@ -480,8 +477,8 @@ ResultType blockingFilteredReduced(Sequence &&sequence,
#ifndef Q_CLANG_QDOC
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ std::enable_if_t<QtPrivate::isInvocable<KeepFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
ResultType blockingFilteredReduced(QThreadPool *pool,
Sequence &&sequence,
KeepFunctor &&keep,
@@ -496,8 +493,8 @@ ResultType blockingFilteredReduced(QThreadPool *pool,
}
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ std::enable_if_t<QtPrivate::isInvocable<KeepFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
ResultType blockingFilteredReduced(Sequence &&sequence,
KeepFunctor &&keep,
ReduceFunctor &&reduce,
@@ -511,9 +508,9 @@ ResultType blockingFilteredReduced(Sequence &&sequence,
}
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
typename InitialValueType,
+ std::enable_if_t<QtPrivate::isInvocable<KeepFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
ResultType blockingFilteredReduced(QThreadPool *pool,
Sequence &&sequence,
@@ -531,9 +528,9 @@ ResultType blockingFilteredReduced(QThreadPool *pool,
}
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
typename InitialValueType,
+ std::enable_if_t<QtPrivate::isInvocable<KeepFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
ResultType blockingFilteredReduced(Sequence &&sequence,
KeepFunctor &&keep,
@@ -627,8 +624,7 @@ ResultType blockingFilteredReduced(Iterator begin,
#ifndef Q_CLANG_QDOC
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
ResultType blockingFilteredReduced(QThreadPool *pool,
Iterator begin,
Iterator end,
@@ -644,8 +640,7 @@ ResultType blockingFilteredReduced(QThreadPool *pool,
}
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
ResultType blockingFilteredReduced(Iterator begin,
Iterator end,
KeepFunctor &&keep,
@@ -660,8 +655,7 @@ ResultType blockingFilteredReduced(Iterator begin,
}
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
ResultType blockingFilteredReduced(QThreadPool *pool,
@@ -679,8 +673,8 @@ ResultType blockingFilteredReduced(QThreadPool *pool,
}
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
+ std::enable_if_t<QtPrivate::isIterator<Iterator>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
ResultType blockingFilteredReduced(Iterator begin,
diff --git a/src/concurrent/qtconcurrentfunctionwrappers.h b/src/concurrent/qtconcurrentfunctionwrappers.h
index 194d020fb2..59d2d61af6 100644
--- a/src/concurrent/qtconcurrentfunctionwrappers.h
+++ b/src/concurrent/qtconcurrentfunctionwrappers.h
@@ -41,6 +41,7 @@
#define QTCONCURRENT_FUNCTIONWRAPPERS_H
#include <QtConcurrent/qtconcurrentcompilertest.h>
+#include <QtCore/qfuture.h>
#include <QtCore/QStringList>
#include <tuple>
@@ -143,6 +144,50 @@ struct ReduceResultType<T(C::*)(U) noexcept>
};
#endif
+template<class T, class Enable = void>
+struct hasCallOperator : std::false_type
+{
+};
+
+template<class T>
+struct hasCallOperator<T, std::void_t<decltype(&T::operator())>> : std::true_type
+{
+};
+
+template<class T, class Enable = void>
+struct isIterator : std::false_type
+{
+};
+
+template<class T>
+struct isIterator<T, std::void_t<typename std::iterator_traits<T>::value_type>> : std::true_type
+{
+};
+
+template <class Callable, class Sequence>
+using isInvocable = std::is_invocable<Callable, typename std::decay_t<Sequence>::value_type>;
+
+template<class Callable, class Enable = void>
+struct ReduceResultTypeHelper
+{
+};
+
+template <class Callable>
+struct ReduceResultTypeHelper<Callable,
+ typename std::enable_if_t<std::is_function_v<std::remove_pointer_t<std::decay_t<Callable>>>
+ || std::is_member_function_pointer_v<std::decay_t<Callable>>>>
+{
+ using type = typename QtPrivate::ReduceResultType<std::decay_t<Callable>>::ResultType;
+};
+
+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>>
+{
+ using type = std::decay_t<typename QtPrivate::ArgResolver<Callable>::First>;
+};
+
// -- MapSequenceResultType
template <class InputSequence, class MapFunctor>
diff --git a/src/concurrent/qtconcurrentmap.h b/src/concurrent/qtconcurrentmap.h
index 4043ecd8a2..44a6caea4c 100644
--- a/src/concurrent/qtconcurrentmap.h
+++ b/src/concurrent/qtconcurrentmap.h
@@ -151,8 +151,8 @@ QFuture<ResultType> mappedReduced(Sequence &&sequence,
}
template <typename Sequence, typename MapFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ std::enable_if_t<QtPrivate::isInvocable<MapFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
QFuture<ResultType> mappedReduced(QThreadPool *pool,
Sequence &&sequence,
MapFunctor &&map,
@@ -166,8 +166,8 @@ QFuture<ResultType> mappedReduced(QThreadPool *pool,
}
template <typename Sequence, typename MapFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ std::enable_if_t<QtPrivate::isInvocable<MapFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
QFuture<ResultType> mappedReduced(Sequence &&sequence,
MapFunctor &&map,
ReduceFunctor &&reduce,
@@ -183,10 +183,9 @@ QFuture<ResultType> mappedReduced(Sequence &&sequence,
template <typename Sequence, typename MapFunctor, typename ReduceFunctor, typename ResultType,
typename InitialValueType>
#else
-template <typename Sequence, typename MapFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
- typename InitialValueType,
+template <typename Sequence, typename MapFunctor, typename ReduceFunctor, typename InitialValueType,
+ std::enable_if_t<QtPrivate::isInvocable<MapFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> mappedReduced(QThreadPool *pool,
@@ -207,10 +206,9 @@ QFuture<ResultType> mappedReduced(QThreadPool *pool,
template <typename Sequence, typename MapFunctor, typename ReduceFunctor, typename ResultType,
typename InitialValueType>
#else
-template <typename Sequence, typename MapFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
- typename InitialValueType,
+template <typename Sequence, typename MapFunctor, typename ReduceFunctor, typename InitialValueType,
+ std::enable_if_t<QtPrivate::isInvocable<MapFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> mappedReduced(Sequence &&sequence,
@@ -299,8 +297,7 @@ QFuture<ResultType> mappedReduced(Iterator begin,
}
template <typename Iterator, typename MapFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
QFuture<ResultType> mappedReduced(QThreadPool *pool,
Iterator begin,
Iterator end,
@@ -315,7 +312,7 @@ QFuture<ResultType> mappedReduced(QThreadPool *pool,
}
template <typename Iterator, typename MapFunctor, typename ReduceFunctor,
- typename ResultType = typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
QFuture<ResultType> mappedReduced(Iterator begin,
Iterator end,
MapFunctor &&map,
@@ -333,8 +330,7 @@ template <typename Iterator, typename MapFunctor, typename ReduceFunctor, typena
typename InitialValueType>
#else
template <typename Iterator, typename MapFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
@@ -357,8 +353,8 @@ template <typename Iterator, typename MapFunctor, typename ReduceFunctor, typena
typename InitialValueType>
#else
template<typename Iterator, typename MapFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
+ std::enable_if_t<QtPrivate::isIterator<Iterator>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
@@ -528,8 +524,8 @@ ResultType blockingMappedReduced(Sequence &&sequence,
}
template <typename MapFunctor, typename ReduceFunctor, typename Sequence,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ std::enable_if_t<QtPrivate::isInvocable<MapFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
ResultType blockingMappedReduced(QThreadPool *pool,
Sequence &&sequence,
MapFunctor &&map,
@@ -545,8 +541,8 @@ ResultType blockingMappedReduced(QThreadPool *pool,
}
template <typename MapFunctor, typename ReduceFunctor, typename Sequence,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ std::enable_if_t<QtPrivate::isInvocable<MapFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
ResultType blockingMappedReduced(Sequence &&sequence,
MapFunctor &&map,
ReduceFunctor &&reduce,
@@ -564,10 +560,9 @@ ResultType blockingMappedReduced(Sequence &&sequence,
template <typename MapFunctor, typename ReduceFunctor, typename Sequence, typename ResultType,
typename InitialValueType>
#else
-template <typename MapFunctor, typename ReduceFunctor, typename Sequence,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
- typename InitialValueType,
+template <typename MapFunctor, typename ReduceFunctor, typename Sequence, typename InitialValueType,
+ std::enable_if_t<QtPrivate::isInvocable<MapFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
ResultType blockingMappedReduced(QThreadPool *pool,
@@ -589,10 +584,9 @@ ResultType blockingMappedReduced(QThreadPool *pool,
template <typename MapFunctor, typename ReduceFunctor, typename Sequence, typename ResultType,
typename InitialValueType>
#else
-template<typename MapFunctor, typename ReduceFunctor, typename Sequence,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
- typename InitialValueType,
+template<typename MapFunctor, typename ReduceFunctor, typename Sequence, typename InitialValueType,
+ std::enable_if_t<QtPrivate::isInvocable<MapFunctor, Sequence>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
ResultType blockingMappedReduced(Sequence &&sequence,
@@ -687,8 +681,7 @@ ResultType blockingMappedReduced(Iterator begin,
}
template <typename Iterator, typename MapFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
ResultType blockingMappedReduced(QThreadPool *pool,
Iterator begin,
Iterator end,
@@ -704,8 +697,7 @@ ResultType blockingMappedReduced(QThreadPool *pool,
}
template <typename Iterator, typename MapFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType>
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type>
ResultType blockingMappedReduced(Iterator begin,
Iterator end,
MapFunctor &&map,
@@ -724,8 +716,7 @@ template <typename Iterator, typename MapFunctor, typename ReduceFunctor, typena
typename InitialValueType>
#else
template <typename Iterator, typename MapFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
@@ -749,8 +740,8 @@ template <typename Iterator, typename MapFunctor, typename ReduceFunctor, typena
typename InitialValueType>
#else
template <typename Iterator, typename MapFunctor, typename ReduceFunctor,
- typename ResultType =
- typename QtPrivate::ReduceResultType<std::decay_t<ReduceFunctor>>::ResultType,
+ std::enable_if_t<QtPrivate::isIterator<Iterator>::value, int> = 0,
+ typename ResultType = typename QtPrivate::ReduceResultTypeHelper<ReduceFunctor>::type,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif