diff options
| author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-02-12 22:35:28 +0100 |
|---|---|---|
| committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-06-12 09:58:58 +0200 |
| commit | dcf76042301772b770a088526e5753ed41232d87 (patch) | |
| tree | 75f29939947c591f6f3277d64c5a5d177d904ac8 /tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp | |
| parent | b1ee49b46533d39f7fabda68d0bd08a1ab130a27 (diff) | |
QVariant::value/qvariant_cast: add rvalue optimization
If we have a rvalue reference to an unshared QVariant, we can avoid
potentially expensive copies, and use move semantics instead.
[ChangeLog][QtCore][QVariant] Added rvalue QVariant overloads of qvariant_cast<T>() and QVariant::value<T>().
[ChangeLog][Potentially Source-Incompatible Changes][QVariant] It is no
longer possible to take the address of a specialization of
qvariant_cast; consider using a lambda function instead.
Change-Id: Ifc74991eadcc31387b755c45484224a3200bb0ba
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp')
| -rw-r--r-- | tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp b/tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp index 114d899e1d5..652b3725059 100644 --- a/tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp +++ b/tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp @@ -32,7 +32,7 @@ void tst_QtConcurrentTask::taskWithFreeFunction() { QVariant value(42); - auto result = task(&qvariant_cast<int>) + auto result = task([](const QVariant &var){ return qvariant_cast<int>(var); }) .withArguments(value) .spawn() .result(); |
