diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-09-29 12:56:08 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-09-29 22:18:01 +0200 |
commit | 5cae73217af3e4ffe4ab903fc8224fcbd356c4e7 (patch) | |
tree | 008ae8610fe04cc32e8c9763b21f1b748c1c2409 /src/corelib/thread | |
parent | a6930724f0d12fbe9befd10f92a604d4a41e5c7a (diff) |
Improve docs for QFuture::{result*, takeResult*}
Change-Id: I559f2fd73a9aae3d126be18cb259f8a9abe0efaf
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r-- | src/corelib/thread/qfuture.qdoc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/corelib/thread/qfuture.qdoc b/src/corelib/thread/qfuture.qdoc index fdb163947b..e15cb419c5 100644 --- a/src/corelib/thread/qfuture.qdoc +++ b/src/corelib/thread/qfuture.qdoc @@ -411,9 +411,12 @@ Returns the first result in the future. If the result is not immediately available, this function will block and wait for the result to become - available. This is a convenience method for calling resultAt(0). + available. This is a convenience method for calling resultAt(0). Note + that \c result() returns a copy of the internally stored result. If \c T is + a move-only type, or you don't want to copy the result, use takeResult() + instead. - \note Calling result() leads to undefined behavior if isValid() + \note Calling \c result() leads to undefined behavior if isValid() returns \c false for this QFuture. \sa resultAt(), results(), takeResult(), takeResults() @@ -458,9 +461,12 @@ /*! \fn template <typename T> QList<T> QFuture<T>::results() const Returns all results from the future. If the results are not immediately available, - this function will block and wait for them to become available. + this function will block and wait for them to become available. Note that + \c results() returns a copy of the internally stored results. If \c T is a + move-only type, or you don't want to copy the results, use takeResults() + instead. - \note Calling results() leads to undefined behavior if isValid() + \note Calling \c results() leads to undefined behavior if isValid() returns \c false for this QFuture. \sa result(), resultAt(), takeResult(), takeResults(), resultCount(), isValid() |