From f805db7c61c646024bfec7cc0de3a1e9bb800792 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 17 Jan 2023 14:34:51 +0100 Subject: [PATCH] Inline two move-constructors in qtimezone.h The move-constructors for QTimeZone and QTimeZone::Data are trivial so can be inlined. Requested by Marc Mutz in 6.5 API review. Pick-to: 6.5 Change-Id: Id59dc95e0da061187d9db8cf0a5ab82fcece1694 Reviewed-by: Thiago Macieira --- src/corelib/time/qtimezone.cpp | 12 ++---------- src/corelib/time/qtimezone.h | 4 ++-- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/corelib/time/qtimezone.cpp b/src/corelib/time/qtimezone.cpp index 3bd7489ebb7..7c1088768cd 100644 --- a/src/corelib/time/qtimezone.cpp +++ b/src/corelib/time/qtimezone.cpp @@ -373,11 +373,6 @@ QTimeZone::Data::Data(const Data &other) noexcept d = other.d; } -QTimeZone::Data::Data(Data &&other) noexcept - : d(std::exchange(other.d, nullptr)) -{ -} - QTimeZone::Data::Data(QTimeZonePrivate *dptr) noexcept : d(dptr) { @@ -674,14 +669,11 @@ QTimeZone::QTimeZone(const QTimeZone &other) noexcept } /*! + \fn QTimeZone::QTimeZone(QTimeZone &&other) noexcept + Move constructor of this from \a other. */ -QTimeZone::QTimeZone(QTimeZone &&other) noexcept - : d(std::move(other.d)) -{ -} - /*! Destroys the time zone. */ diff --git a/src/corelib/time/qtimezone.h b/src/corelib/time/qtimezone.h index a4857ca95bf..20b6df2ad54 100644 --- a/src/corelib/time/qtimezone.h +++ b/src/corelib/time/qtimezone.h @@ -58,7 +58,7 @@ class Q_CORE_EXPORT QTimeZone Data() noexcept; Data(ShortData sd) : s(sd) {} Data(const Data &other) noexcept; - Data(Data &&other) noexcept; + Data(Data &&other) noexcept : d(std::exchange(other.d, nullptr)) {} Data &operator=(const Data &other) noexcept; Data &operator=(Data &&other) noexcept { swap(other); return *this; } ~Data(); @@ -105,7 +105,7 @@ public: #endif // timezone backends QTimeZone(const QTimeZone &other) noexcept; - QTimeZone(QTimeZone &&other) noexcept; + QTimeZone(QTimeZone &&other) noexcept : d(std::move(other.d)) {} ~QTimeZone(); QTimeZone &operator=(const QTimeZone &other);