summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qfuture.qdoc
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2023-03-14 17:55:44 +0100
committerIvan Solovev <ivan.solovev@qt.io>2023-04-05 13:38:14 +0200
commit7f38f9f394b7283de93a2367765572241dede84b (patch)
tree84dd519202d0d247d2c59db9941f955a1e67c8dc /src/corelib/thread/qfuture.qdoc
parent10242a825099d693b390d9598491c3bcecc336b7 (diff)
Long live QtFuture::makeReadyRangeFuture()
[ChangeLog][QtCore][QFuture] Introduce QtFuture::makeReadyRangeFuture(). This method takes a container which has input iterators and returns a multi-value QFuture<ValueType>, where ValueType is the underlying type of the input container. This commit also replaces the usage of buggy QtFuture::makeReadyFuture(const QList<T> &) overload with the new method. Task-number: QTBUG-109677 Change-Id: I019e62eac74c643d88a65b3cc0085bc7c33bc712 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/thread/qfuture.qdoc')
-rw-r--r--src/corelib/thread/qfuture.qdoc41
1 files changed, 38 insertions, 3 deletions
diff --git a/src/corelib/thread/qfuture.qdoc b/src/corelib/thread/qfuture.qdoc
index 50ec206afd..7ba4debeea 100644
--- a/src/corelib/thread/qfuture.qdoc
+++ b/src/corelib/thread/qfuture.qdoc
@@ -118,14 +118,15 @@
combine several futures and track when the last or first of them completes.
A ready QFuture object with a value or a QFuture object holding exception can
- be created using convenience functions QtFuture::makeReadyFuture() and
- QtFuture::makeExceptionalFuture().
+ be created using convenience functions QtFuture::makeReadyFuture(),
+ QtFuture::makeReadyRangeFuture(), and QtFuture::makeExceptionalFuture().
\note To start a computation and store results in a QFuture, use QPromise or
one of the APIs in the \l {Qt Concurrent} framework.
\sa QPromise, QtFuture::connect(), QtFuture::makeReadyFuture(),
- QtFuture::makeExceptionalFuture(), QFutureWatcher, {Qt Concurrent}
+ QtFuture::makeReadyRangeFuture(), QtFuture::makeExceptionalFuture(),
+ QFutureWatcher, {Qt Concurrent}
*/
/*! \fn template <typename T> QFuture<T>::QFuture()
@@ -1068,6 +1069,40 @@
\sa QFuture, QException, QtFuture::makeReadyFuture()
*/
+/*! \fn template<typename Container, QtFuture::if_container_with_input_iterators<Container>> static QFuture<QtFuture::ContainedType<Container>> QtFuture::makeReadyRangeFuture(Container &&container)
+
+ \since 6.6
+ \overload
+
+ Takes an input container \a container and returns a QFuture with multiple
+ results of type \c ContainedType initialized from the values of the
+ \a container.
+
+ \note This overload only participates in overload resolution if the
+ \c Container has input iterators.
+
+ \snippet code/src_corelib_thread_qfuture.cpp 32
+ \dots
+ \snippet code/src_corelib_thread_qfuture.cpp 34
+
+ \sa QFuture, QtFuture::makeReadyFuture(), QtFuture::makeExceptionalFuture()
+*/
+
+/*! \fn template<typename ValueType> static QFuture<ValueType> QtFuture::makeReadyRangeFuture(std::initializer_list<ValueType> values)
+
+ \since 6.6
+ \overload
+
+ Returns a QFuture with multiple results of type \c ValueType initialized
+ from the input initializer list \a values.
+
+ \snippet code/src_corelib_thread_qfuture.cpp 33
+ \dots
+ \snippet code/src_corelib_thread_qfuture.cpp 34
+
+ \sa QFuture, QtFuture::makeReadyFuture(), QtFuture::makeExceptionalFuture()
+*/
+
/*! \fn template<class T> template<class Function> QFuture<typename QFuture<T>::ResultType<Function>> QFuture<T>::then(Function &&function)
\since 6.0