From e9c9e9225c333799258bb75c98f8722e074f272e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 22 Jul 2022 17:23:08 -0700 Subject: QVariant: make many more QtCore types nothrow-copyable All of those are implicitly-shared Qt data types whose copy constructors can't throw and have wide contracts (there aren't even any assertions for validity in any of them). These are all types with a QVariant implicit constructor, except for QCborValue, which is updated on this list so QJsonValue (which has a QVariant constructor) is also legitimately noexcept. To ensure we haven't made a mistake, the Private constructor checks again. Change-Id: I3859764fed084846bcb0fffd17044d8319a45e1f Reviewed-by: Fabian Kosmale --- src/corelib/serialization/qjsonarray.cpp | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'src/corelib/serialization/qjsonarray.cpp') diff --git a/src/corelib/serialization/qjsonarray.cpp b/src/corelib/serialization/qjsonarray.cpp index 167b6a3a773..33f4d51b5fb 100644 --- a/src/corelib/serialization/qjsonarray.cpp +++ b/src/corelib/serialization/qjsonarray.cpp @@ -138,11 +138,13 @@ QJsonArray::QJsonArray(std::initializer_list args) Since QJsonArray is implicitly shared, the copy is shallow as long as the object doesn't get modified. */ -QJsonArray::QJsonArray(const QJsonArray &other) -{ - a = other.a; -} +QJsonArray::QJsonArray(const QJsonArray &other) noexcept = default; + +/*! + \since 5.10 + Move-constructs a QJsonArray from \a other. +*/ QJsonArray::QJsonArray(QJsonArray &&other) noexcept : a(other.a) { @@ -152,18 +154,7 @@ QJsonArray::QJsonArray(QJsonArray &&other) noexcept /*! Assigns \a other to this array. */ -QJsonArray &QJsonArray::operator =(const QJsonArray &other) -{ - a = other.a; - return *this; -} - -/*! - \fn QJsonArray::QJsonArray(QJsonArray &&other) - \since 5.10 - - Move-constructs a QJsonArray from \a other. -*/ +QJsonArray &QJsonArray::operator =(const QJsonArray &other) noexcept = default; /*! \fn QJsonArray &QJsonArray::operator =(QJsonArray &&other) -- cgit v1.2.3