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>
This commit is contained in:
parent
bb02b9696e
commit
95326a2977
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user