qt5base-lts/tests/auto/corelib
Timur Pocheptsov 44ceb56455 QFuture - add ability to move results from QFuture
QFuture's original design pre-dates C++11 and its
introduction of move semantics. QFuture is documented
as requiring copy-constructible classes and uses copy
operations for results (which in Qt's universe in general
is relatively cheap, due to the use of COW/data sharing).
QFuture::result(), QFuture::results(), QFuture::resultAt()
return copies. Now that the year is 2020, it makes some
sense to add support for move semantics and, in particular,
move-only types, like std::unique_ptr (that cannot be
obtained from QFuture using result etc.). Taking a result
or results from a QFuture renders it invalid.  This patch
adds QFuture<T>::takeResults(), takeResult() and isValid().
'Taking' functions are 'enabled_if' for non-void types only
to improve the compiler's diagnostic (which would otherwise
spit some semi-articulate diagnostic).
As a bonus a bug was found in the pre-existing code (after
initially copy and pasted into the new function) - the one
where we incorrectly report ready results in (rather obscure)
filter mode.

Fixes: QTBUG-81941
Fixes: QTBUG-83182
Change-Id: I8ccdfc50aa310a3a79eef2cdc55f5ea210f889c3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-31 15:28:23 +02:00
..
animation Merge remote-tracking branch 'origin/5.15' into dev 2020-03-16 18:41:27 +01:00
codecs Regenerate tests/auto/corelib/codecs 2019-11-12 17:26:41 +00:00
global Remove QLinkedList 2020-02-19 21:01:07 +01:00
io Q{File,FileInfo,Dir}: add std::filesystem::path overloads 2020-03-24 16:20:03 +01:00
itemmodels Make MatchRegExp an alias to MatchRegularExpression 2020-03-30 11:33:07 +01:00
kernel Make QPropertyBindingPrivate accessible to QtQml 2020-03-27 13:29:47 +01:00
mimetypes QtConcurrent::run: accept more then five function's arguments 2020-03-11 14:46:25 +01:00
plugin Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-03-16 20:43:50 +01:00
serialization CMake: Regenerate tests projects 2020-03-12 11:41:39 +01:00
statemachine Merge remote-tracking branch 'origin/5.15' into dev 2020-02-13 18:31:40 +01:00
text Merge remote-tracking branch 'origin/5.15' into dev 2020-03-18 11:45:08 +01:00
thread QFuture - add ability to move results from QFuture 2020-03-31 15:28:23 +02:00
time Purge QRegExp use in QDateTime's rfcDateImpl() 2020-02-27 10:48:25 +01:00
tools Change QTaggedPointer API to be more similar to other smart pointers in Qt 2020-03-19 19:01:31 +01:00
.prev_CMakeLists.txt cmake: Remove APPLE prefix from platform names 2020-03-16 17:57:56 +01:00
CMakeLists.txt cmake: Remove APPLE prefix from platform names 2020-03-16 17:57:56 +01:00
corelib.pro Move text-related code out of corelib/tools/ to corelib/text/ 2019-07-10 17:05:30 +02:00