Add move constructor to QHostAddress

The class has a move assignment operator, it should have a move
constructor as well.

Found by an Axivion scan.

Task-number: QTBUG-125026
Change-Id: I301e8e3f275b0d5217afc1559947870ff87bcf45
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 1caee12b1ac8cef3aabd8d2e319c88a84c64c585)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
bb10
Mate Barany 2024-07-02 13:55:01 +02:00 committed by Qt Cherry-pick Bot
parent a0f2d10c00
commit 7fa938754a
2 changed files with 16 additions and 0 deletions

View File

@ -34,6 +34,8 @@ QHostAddressPrivate::QHostAddressPrivate()
memset(&a6, 0, sizeof(a6));
}
QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QHostAddressPrivate)
void QHostAddressPrivate::setAddress(quint32 a_)
{
a = a_;
@ -449,6 +451,18 @@ QHostAddress::QHostAddress(const QHostAddress &address)
{
}
/*!
\fn QHostAddress::QHostAddress(QHostAddress &&other)
\since 6.8
Move-constructs a new QHostAddress from \a other.
\note The moved-from object \a other is placed in a partially-formed state,
in which the only valid operations are destruction and assignment of a new
value.
*/
/*!
Constructs a QHostAddress object for \a address.
*/

View File

@ -19,6 +19,7 @@ QT_BEGIN_NAMESPACE
class QHostAddressPrivate;
QT_DECLARE_QESDP_SPECIALIZATION_DTOR(QHostAddressPrivate)
class QT6_ONLY(Q_NETWORK_EXPORT) QIPv6Address
{
@ -81,6 +82,7 @@ public:
explicit QHostAddress(const sockaddr *address);
explicit QHostAddress(const QString &address);
QHostAddress(const QHostAddress &copy);
QHostAddress(QHostAddress &&other) noexcept = default;
QHostAddress(SpecialAddress address);
~QHostAddress();