summaryrefslogtreecommitdiffstats
path: root/src/concurrent/qtconcurrentstoredfunctioncall.h
diff options
context:
space:
mode:
authorVitaly Fanaskov <[email protected]>2020-03-11 18:07:03 +0100
committerVitaly Fanaskov <[email protected]>2020-03-29 20:44:32 +0100
commit5a0d4f3313157d2fe48e9d159968bed6883eb5f8 (patch)
treed7366ac16fdbe83ff4e8006577f9987404ae2742 /src/concurrent/qtconcurrentstoredfunctioncall.h
parentd975ad4ed728553b765c61f38c1e0df899187cf5 (diff)
QtConcurrent: add fluent interface to configure a task before run
Task-number: QTBUG-82950 Change-Id: I449da938b6b501a7646b3425edde5c880d6ca87e Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Paul Wicking <[email protected]> Reviewed-by: Mikhail Svetkin <[email protected]>
Diffstat (limited to 'src/concurrent/qtconcurrentstoredfunctioncall.h')
-rw-r--r--src/concurrent/qtconcurrentstoredfunctioncall.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/concurrent/qtconcurrentstoredfunctioncall.h b/src/concurrent/qtconcurrentstoredfunctioncall.h
index e2d0e3de0fd..f64648d7e96 100644
--- a/src/concurrent/qtconcurrentstoredfunctioncall.h
+++ b/src/concurrent/qtconcurrentstoredfunctioncall.h
@@ -48,7 +48,6 @@
QT_BEGIN_NAMESPACE
-
#ifndef Q_QDOC
namespace QtConcurrent {
@@ -65,16 +64,20 @@ struct InvokeResult
template <class Function, class ...Args>
using InvokeResultType = typename InvokeResult<Function, Args...>::Type;
+template <class ...Types>
+using DecayedTuple = std::tuple<std::decay_t<Types>...>;
+
template <class Function, class ...Args>
struct StoredFunctionCall : public RunFunctionTask<InvokeResultType<Function, Args...>>
{
- template <class ...Types>
- using DecayedTuple = std::tuple<std::decay_t<Types>...>;
-
StoredFunctionCall(Function &&f, Args &&...args)
: data{std::forward<Function>(f), std::forward<Args>(args)...}
{}
+ StoredFunctionCall(DecayedTuple<Function, Args...> &&_data)
+ : data(std::move(_data))
+ {}
+
void runFunctor() override
{
using Indexes =