summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlist.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-11-04 15:02:04 +0100
committerLars Knoll <lars.knoll@qt.io>2020-11-17 11:45:33 +0100
commit1c1c593510e91a442cbb73bb4d5b6e9de135afdb (patch)
tree6af24a24aa4a378295ab3e119ad69e8ebd3217d4 /src/corelib/tools/qlist.h
parentc9420aeefffa1eccb417a3985b1cfef049b3fd34 (diff)
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>
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r--src/corelib/tools/qlist.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 27be22fc1f..f80553d976 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -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) {