QVariant::setValue(T&&): remove a facually incorrect comment

The function template is constrained in the template-initializer to
only rvalues, therefore this overload is never instantiated for
lvalue.

Amends 79ae79d05c65019233cf9ae9e77ef59d90e75ac2.

Pick-to: 6.7
Change-Id: If0260799fa233eba1ccb3545b9d053496901fc2e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 297bc0fb306954dbdf34d80017055b6924315d81)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-08-02 14:27:19 +02:00 committed by Qt Cherry-pick Bot
parent 42c467a11d
commit 25b1405dbf

View File

@ -552,9 +552,8 @@ public:
return QVariant();
QMetaType mt = QMetaType::fromType<Type>();
mt.registerType(); // we want the type stored in QVariant to always be registered
// T is a forwarding reference, so if T satifies the enable-ifery,
// we get this overload even if T is an lvalue reference and thus must check here
// Moreover, we only try to move if the type is actually moveable and not if T is const
// We only try to move if the type is actually moveable and not if T is const
// as in const int i; QVariant::fromValue(std::move(i));
if constexpr (std::conjunction_v<std::is_move_constructible<Type>, std::negation<std::is_const<T>>>)
return moveConstruct(QMetaType::fromType<Type>(), std::addressof(value));