summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-06-24 02:56:30 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-07-06 17:59:00 +0200
commit95326a2977ddb734716c0d17e3edcdb00c5c4bca (patch)
tree4630f7dd62793222e639a5f4645f7b45623b96d6
parentbb02b9696e9b8c73cc00a1535d93b99c3a3fd4d0 (diff)
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 <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--src/corelib/tools/qlist.h11
1 files 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<T> &other) noexcept : d(other.d) {}
- QList(QList<T> &&other) noexcept : d(std::move(other.d)) {}
inline QList(std::initializer_list<T> args)
: d(Data::allocate(args.size()))
{
@@ -137,13 +135,6 @@ public:
d->copyAppend(args.begin(), args.end());
}
- ~QList() /*noexcept(std::is_nothrow_destructible<T>::value)*/ {}
- QList<T> &operator=(const QList<T> &other) { d = other.d; return *this; }
- QList &operator=(QList &&other) noexcept(std::is_nothrow_destructible<T>::value)
- {
- d = std::move(other.d);
- return *this;
- }
QList<T> &operator=(std::initializer_list<T> 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<T> &other) noexcept { qSwap(d, other.d); }
friend bool operator==(const QList &l, const QList &r)