diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2023-03-20 16:11:15 +0100 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2023-04-05 13:38:15 +0200 |
commit | 9b4b32ec98bf80023d2233a061564dfe59b783c7 (patch) | |
tree | 42ea1e44c26e9ba38e52b9b159dbfd6d8fddd288 /src/corelib/thread/qfuture.h | |
parent | 7f38f9f394b7283de93a2367765572241dede84b (diff) |
Long live QtFuture::makeReadyVoidFuture() and QtFuture::makeReadyValueFuture()
[ChangeLog][QtCore][QFuture] Added QtFuture::makeReadyVoidFuture()
and QtFuture::makeReadyValueFuture().
Basically, these methods behave like QtFuture::makeReadyFuture(), but
QtFuture::makeReadyValueFuture() does not have a "const QList<T> &"
specialization returning QFuture<T> instead of QFuture<QList<T>>,
which allows it to always behave consistently.
This patch also introduces usage of the new methods around qtbase.
Task-number: QTBUG-109677
Change-Id: I89df8b26d82c192baad69efb5df517a8b182995f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/thread/qfuture.h')
-rw-r--r-- | src/corelib/thread/qfuture.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/thread/qfuture.h b/src/corelib/thread/qfuture.h index 34fb8a039d..219d3368f0 100644 --- a/src/corelib/thread/qfuture.h +++ b/src/corelib/thread/qfuture.h @@ -522,6 +522,16 @@ QFuture<std::variant<std::decay_t<Futures>...>> whenAny(Futures &&... futures); #endif // Q_QDOC +#if defined(Q_QDOC) +static QFuture<void> makeReadyFuture() +#else +template<typename T = void> +static QFuture<T> makeReadyFuture() +#endif +{ + return makeReadyVoidFuture(); +} + } // namespace QtFuture Q_DECLARE_SEQUENTIAL_ITERATOR(Future) |