From 1c1c593510e91a442cbb73bb4d5b6e9de135afdb Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 4 Nov 2020 15:02:04 +0100 Subject: [PATCH] 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 Reviewed-by: Andrei Golubev --- src/corelib/tools/qlist.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 27be22fc1f8..f80553d9766 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -322,9 +322,7 @@ public: } void append(const QList &l) { - // protect against l == *this - QList list(l); - append(list.constBegin(), list.constEnd()); + append(l.constBegin(), l.constEnd()); } void append(QList &&l); void prepend(rvalue_ref t) {