qt5base-lts/tests/auto
Marc Mutz de3e970889 Implement [variant.get] for QVariant [1/2]: get_if()
QVariant supports non-default-constructible payloads, in principle
(QTBUG-105140). And fromValue() works with such types, but value()
insists on providing a wide contract and therefore accidentally
requires default-constructible.

We can now invent other "Qt-ish" API like optional::value_or() or a
value() that returns optional<T>, but we should first get the
interface in that generic code must use, and which at the same time is
the most versatile, because it gives write access to the element
stored in the variant: [variant.get], consisting of get_if(), get(),
and holds_alternative(). The latter is the same as get_if() !=
nullptr, so we won't provide it.

This first patch implements get_if(), adds test for it.

As a Hidden Friend supposed to be called with explicit template
arguments, we run into the problem that wg21.link/P0846 solved for
C++20. Add the usual work-around, and check it works.

The ChangeLog will be on the last patch.

Task-number: QTBUG-111598
Change-Id: I23f57ea2de3946944810c5552c68a7a3060a44f2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-03-24 06:40:11 +01:00
..
bic/data Revert "Revert "Add binary compatibility file generated against 6.4.0"" 2023-01-23 14:51:55 +00:00
cmake Fix for CMake tests when build with unity 2023-03-14 17:28:43 +01:00
concurrent QThread: add sleep(std::chrono::nanoseconds) overload 2023-03-13 23:26:28 +02:00
corelib Implement [variant.get] for QVariant [1/2]: get_if() 2023-03-24 06:40:11 +01:00
dbus QThread: add sleep(std::chrono::nanoseconds) overload 2023-03-13 23:26:28 +02:00
gui Verify fix for manual get<I> calls for QVector<N>D 2023-03-22 15:59:10 +00:00
guiapplauncher Move Weather Anchor Layout example to manual tests 2023-03-02 05:55:57 +01:00
network Revert "Skip socket and server tests on Ubuntu 22.04 and QEMU" 2023-03-20 17:39:18 +01:00
opengl tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
other Use qt_internal_add_executable in auto tests 2023-03-14 17:28:43 +01:00
printsupport tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
shared tests: remove PlatformInputContext::filterEvent() 2023-01-18 13:21:06 +01:00
sql SQL/Tests: Cleanup of tst_databases.h 2023-03-17 23:08:44 +01:00
testlib Testlib: fix the last few s/Q_OS_MAC/Q_OS_DARWIN/w 2023-03-20 19:18:52 +01:00
tools moc: Allow anonymous properties 2023-03-16 14:17:24 +01:00
wasm Support filter list for file input when opening a file on WASM 2023-03-07 12:50:41 +01:00
widgets Widgets/QCheckBox: change signature of stateChanged() for Qt7 2023-03-21 20:33:10 +01:00
xml tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
network-settings.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00