QVariant: move and swap in the move assignment operator

And not pure swap. As per policy, QVariant must leave the rhs empty.

Change-Id: I2d5e0f584c4d4fffd05a0a5bfae27ddcb72430e9
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Giuseppe D'Angelo 2020-06-06 01:31:07 +02:00
parent c0f7ecab20
commit 725c37ffe0

View File

@ -271,7 +271,7 @@ class Q_CORE_EXPORT QVariant
inline QVariant(QVariant &&other) noexcept : d(other.d)
{ other.d = Private(); }
inline QVariant &operator=(QVariant &&other) noexcept
{ qSwap(d, other.d); return *this; }
{ QVariant moved(std::move(other)); swap(moved); return *this; }
inline void swap(QVariant &other) noexcept { qSwap(d, other.d); }