From 5cae73217af3e4ffe4ab903fc8224fcbd356c4e7 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Tue, 29 Sep 2020 12:56:08 +0200 Subject: [PATCH] Improve docs for QFuture::{result*, takeResult*} Change-Id: I559f2fd73a9aae3d126be18cb259f8a9abe0efaf Reviewed-by: Paul Wicking --- src/corelib/thread/qfuture.qdoc | 14 ++++++++++---- 1 file 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 QList QFuture::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()