From a6f8aa0ae1d5a1d1099df1891ea60b14b6eb6065 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 28 Mar 2014 08:41:10 +0100 Subject: QStringList: use QList:.swap(int,int) in removeDuplicates instead of assignment This is faster because it just swaps the pointers stored instead of touching the refcounts. It's the same as qMove()ing the right-hand-side, but benefits C++98, too. Change-Id: I6b7e3d0e5c7eb81f88fe9069d6662335d24aa86c Reviewed-by: Olivier Goffart --- src/corelib/tools/qstringlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/tools/qstringlist.cpp') diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index 30be41a4bd..a9d704ca4c 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -726,7 +726,7 @@ int QtPrivate::QStringList_removeDuplicates(QStringList *that) continue; seen.insert(s); if (j != i) - (*that)[j] = s; + that->swap(i, j); ++j; } if (n != j) -- cgit v1.2.3