From 936632c9c1e92de899bb17596a66167e8d515bc4 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 2 May 2019 11:46:32 +0200 Subject: [PATCH] QList: fix regression in swapItemsAt Commit e0d2b50249839d10ecf87abc296b8020046d1d75 makes swapItemsAt use ADL to find swap(). Problem is, QList has a swap() function (that swaps the elements at the specificed _indices_); that function will be found before ADL kicks in. So do the second best thing: use qSwap instead. Change-Id: Icf2b4e3ce09117e4056acbad3e2d8a625861d807 Reviewed-by: Lars Knoll --- src/corelib/tools/qlist.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 59578b1e617..b916dcfd24a 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -707,8 +707,7 @@ inline void QList::swapItemsAt(int i, int j) Q_ASSERT_X(i >= 0 && i < p.size() && j >= 0 && j < p.size(), "QList::swap", "index out of range"); detach(); - using std::swap; - swap(d->array[d->begin + i], d->array[d->begin + j]); + qSwap(d->array[d->begin + i], d->array[d->begin + j]); } template