QList::append(QList) doesn't require a temp copy

The method can simply forward to the append overload taking
iterators. That method is safe against the iterators being
part of the list itself.

Change-Id: I4bebd6c1118cd4a428fa9248235029b997ef60b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This commit is contained in:
Lars Knoll 2020-11-04 15:02:04 +01:00
parent c9420aeeff
commit 1c1c593510

View File

@ -322,9 +322,7 @@ public:
}
void append(const QList<T> &l)
{
// protect against l == *this
QList list(l);
append(list.constBegin(), list.constEnd());
append(l.constBegin(), l.constEnd());
}
void append(QList<T> &&l);
void prepend(rvalue_ref t) {