diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2020-02-26 18:06:49 +0100 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2020-03-04 17:40:45 +0100 |
commit | d57adfe5f375121c3e233465526ee5d9df03e1e9 (patch) | |
tree | ecf9892b6e7a954f145ef74743caa932033b5253 /src/concurrent/qtconcurrentreducekernel.h | |
parent | d50b22e75df0e0fcecf987813b873e717a225e66 (diff) |
QtConcurrent: filter- and map-reduce with initial value
It takes any type which is implictly covertible to the result type
and then converts it in the outer-layers. Then it passes it into the
deeper layers and initiales the result value.
One drive-by fix with a missing letter in the documentation.
[ChangeLog][QtConcurrent] QtConcurrent::mappedReduce and
QtConcurrent::filteredReduced, as well as their blocking variants,
now optionally take an initial value.
Fixes: QTBUG-73240
Change-Id: I7a80d96693cfa3374847c75c75b3167664609c1a
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/concurrent/qtconcurrentreducekernel.h')
-rw-r--r-- | src/concurrent/qtconcurrentreducekernel.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/concurrent/qtconcurrentreducekernel.h b/src/concurrent/qtconcurrentreducekernel.h index 8f9a938952..eabc432374 100644 --- a/src/concurrent/qtconcurrentreducekernel.h +++ b/src/concurrent/qtconcurrentreducekernel.h @@ -232,6 +232,16 @@ struct SequenceHolder2 : public Base sequence(_sequence) { } + template <typename InitialValueType> + SequenceHolder2(const Sequence &_sequence, + Functor1 functor1, + Functor2 functor2, + InitialValueType &&initialValue, + ReduceOptions reduceOptions) + : Base(_sequence.begin(), _sequence.end(), functor1, functor2, std::forward<InitialValueType>(initialValue), reduceOptions), + sequence(_sequence) + { } + Sequence sequence; void finish() override |