From 95326a2977ddb734716c0d17e3edcdb00c5c4bca Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 24 Jun 2020 02:56:30 +0200 Subject: [PATCH] QList: go for the rule of zero The hand-written special member functions did exactly what the compiler generated ones would do anyhow. Change-Id: I66439178460d30957135aac44680dd3109ada62a Reviewed-by: Volker Hilsheimer Reviewed-by: Lars Knoll --- src/corelib/tools/qlist.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 8a63e1283b..e041b4132a 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -128,8 +128,6 @@ public: d->copyAppend(size, t); } - inline QList(const QList &other) noexcept : d(other.d) {} - QList(QList &&other) noexcept : d(std::move(other.d)) {} inline QList(std::initializer_list args) : d(Data::allocate(args.size())) { @@ -137,13 +135,6 @@ public: d->copyAppend(args.begin(), args.end()); } - ~QList() /*noexcept(std::is_nothrow_destructible::value)*/ {} - QList &operator=(const QList &other) { d = other.d; return *this; } - QList &operator=(QList &&other) noexcept(std::is_nothrow_destructible::value) - { - d = std::move(other.d); - return *this; - } QList &operator=(std::initializer_list args) { d = DataPointer(Data::allocate(args.size())); @@ -167,6 +158,8 @@ public: std::copy(i1, i2, std::back_inserter(*this)); } + // compiler-generated special member functions are fine! + void swap(QList &other) noexcept { qSwap(d, other.d); } friend bool operator==(const QList &l, const QList &r)