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/QXmppIq.cpp | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'src/base/QXmppIq.cpp') diff --git a/src/base/QXmppIq.cpp b/src/base/QXmppIq.cpp index efb35396..3d9f5422 100644 --- a/src/base/QXmppIq.cpp +++ b/src/base/QXmppIq.cpp @@ -22,10 +22,11 @@ public: QXmppIq::Type type; }; +/// /// Constructs a QXmppIq with the specified \a type. /// /// \param type - +/// QXmppIq::QXmppIq(QXmppIq::Type type) : QXmppStanza(), d(new QXmppIqPrivate) { @@ -34,37 +35,29 @@ QXmppIq::QXmppIq(QXmppIq::Type type) } /// Constructs a copy of \a other. - -QXmppIq::QXmppIq(const QXmppIq &other) - : QXmppStanza(other), d(other.d) -{ -} - -QXmppIq::~QXmppIq() -{ -} +QXmppIq::QXmppIq(const QXmppIq &other) = default; +/// Default move-constructor. +QXmppIq::QXmppIq(QXmppIq &&) = default; +QXmppIq::~QXmppIq() = default; /// Assigns \a other to this IQ. +QXmppIq &QXmppIq::operator=(const QXmppIq &other) = default; +/// Move-assignment operator. +QXmppIq &QXmppIq::operator=(QXmppIq &&) = default; -QXmppIq &QXmppIq::operator=(const QXmppIq &other) -{ - QXmppStanza::operator=(other); - d = other.d; - return *this; -} - +/// /// Returns the IQ's type. /// - QXmppIq::Type QXmppIq::type() const { return d->type; } +/// /// Sets the IQ's type. /// /// \param type - +/// void QXmppIq::setType(QXmppIq::Type type) { d->type = type; -- cgit v1.2.3