diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2019-05-02 11:46:32 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2019-05-02 13:24:36 +0000 |
commit | 936632c9c1e92de899bb17596a66167e8d515bc4 (patch) | |
tree | 3fb07e59f2e15d049e657c824f471ca87dcbdf0a /src/corelib/tools/qlist.h | |
parent | 91b3099d713b25367aafaf0aa8b719b7bd316155 (diff) |
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 <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r-- | src/corelib/tools/qlist.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 59578b1e61..b916dcfd24 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -707,8 +707,7 @@ inline void QList<T>::swapItemsAt(int i, int j) Q_ASSERT_X(i >= 0 && i < p.size() && j >= 0 && j < p.size(), "QList<T>::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 <typename T> |