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>
This commit is contained in:
parent
91b3099d71
commit
936632c9c1
@ -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(),
|
Q_ASSERT_X(i >= 0 && i < p.size() && j >= 0 && j < p.size(),
|
||||||
"QList<T>::swap", "index out of range");
|
"QList<T>::swap", "index out of range");
|
||||||
detach();
|
detach();
|
||||||
using std::swap;
|
qSwap(d->array[d->begin + i], d->array[d->begin + j]);
|
||||||
swap(d->array[d->begin + i], d->array[d->begin + j]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user