QList: fix regression in swapItemsAt

Commit e0d2b50249 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>
This commit is contained in:
Giuseppe D'Angelo 2019-05-02 11:46:32 +02:00
parent 91b3099d71
commit 936632c9c1

View File

@ -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>