summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qmenubar/qmenubar.pro
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-03-03 11:20:06 +0100
committerMarc Mutz <marc.mutz@qt.io>2023-03-24 06:40:11 +0100
commitde3e9708898da6a6480e973308d228b8dcc3b139 (patch)
treeac82c9c78221a96034884028fedcfcfa788cb9f3 /tests/auto/widgets/widgets/qmenubar/qmenubar.pro
parent8570e86fff183ffa4c1dff577c7fa14e3342daee (diff)
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>
Diffstat (limited to 'tests/auto/widgets/widgets/qmenubar/qmenubar.pro')
0 files changed, 0 insertions, 0 deletions