From 31ef165cbbf918ba0ddd00f86c6dee257a0b936b Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Fri, 17 Jun 2022 18:26:01 +0200 Subject: Add move constructors and move assignment operators everywhere This is so std::move() on implicitly-shared types actually moves the content and doesn't call the copy ctor/assignment operator. --- src/base/QXmppStanza.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'src/base/QXmppStanza.cpp') diff --git a/src/base/QXmppStanza.cpp b/src/base/QXmppStanza.cpp index d225b829..e4192128 100644 --- a/src/base/QXmppStanza.cpp +++ b/src/base/QXmppStanza.cpp @@ -186,11 +186,13 @@ QXmppExtendedAddress::QXmppExtendedAddress() /// Default copy-constructur QXmppExtendedAddress::QXmppExtendedAddress(const QXmppExtendedAddress &other) = default; - +/// Default move-constructur +QXmppExtendedAddress::QXmppExtendedAddress(QXmppExtendedAddress &&) = default; QXmppExtendedAddress::~QXmppExtendedAddress() = default; - /// Default assignment operator QXmppExtendedAddress &QXmppExtendedAddress::operator=(const QXmppExtendedAddress &other) = default; +/// Default assignment operator +QXmppExtendedAddress &QXmppExtendedAddress::operator=(QXmppExtendedAddress &&) = default; /// /// Returns the human-readable description of the address. @@ -321,6 +323,8 @@ QXmppStanza::Error::Error() /// Copy constructor QXmppStanza::Error::Error(const QXmppStanza::Error &) = default; +/// Move constructor +QXmppStanza::Error::Error(QXmppStanza::Error &&) = default; /// /// Initializes an error with a type, condition and text. @@ -347,9 +351,10 @@ QXmppStanza::Error::Error(const QString &type, const QString &cond, /// Default destructor QXmppStanza::Error::~Error() = default; - /// Copy operator QXmppStanza::Error &QXmppStanza::Error::operator=(const QXmppStanza::Error &) = default; +/// Move operator +QXmppStanza::Error &QXmppStanza::Error::operator=(QXmppStanza::Error &&) = default; /// /// Returns the human-readable description of the error. @@ -725,21 +730,15 @@ QXmppE2eeMetadata::QXmppE2eeMetadata(QSharedDataPointer