QList::swap: implement the swap with std::swap

Change-Id: Ide2f8a5581978986607de99ac9b5e9c15b3aceff
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Giuseppe D'Angelo 2014-11-25 10:22:54 +01:00
parent 9d771c70c3
commit dd97634f80

View File

@ -628,9 +628,7 @@ inline void QList<T>::swap(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();
void *t = d->array[d->begin + i];
d->array[d->begin + i] = d->array[d->begin + j];
d->array[d->begin + j] = t;
std::swap(d->array[d->begin + i], d->array[d->begin + j]);
}
template <typename T>