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:
parent
c9420aeeff
commit
1c1c593510
@ -322,9 +322,7 @@ public:
|
|||||||
}
|
}
|
||||||
void append(const QList<T> &l)
|
void append(const QList<T> &l)
|
||||||
{
|
{
|
||||||
// protect against l == *this
|
append(l.constBegin(), l.constEnd());
|
||||||
QList list(l);
|
|
||||||
append(list.constBegin(), list.constEnd());
|
|
||||||
}
|
}
|
||||||
void append(QList<T> &&l);
|
void append(QList<T> &&l);
|
||||||
void prepend(rvalue_ref t) {
|
void prepend(rvalue_ref t) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user