Prepare QVector::operator==() for sharing with QList::operator==()
...by implementing it via std::equal(). This might also enable STL implementations to choose a hand-optimized version of the algorithm for C++ builtin types. Change-Id: I1347a7f365b3d2947f19a81b95aa8d89b8ad303d Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
023e6bd937
commit
c6752c5aa1
@ -707,13 +707,10 @@ bool QVector<T>::operator==(const QVector<T> &v) const
|
|||||||
return true;
|
return true;
|
||||||
if (d->size != v.d->size)
|
if (d->size != v.d->size)
|
||||||
return false;
|
return false;
|
||||||
T* e = d->end();
|
const T *vb = v.d->begin();
|
||||||
T* i = d->begin();
|
const T *b = d->begin();
|
||||||
T* vi = v.d->begin();
|
const T *e = d->end();
|
||||||
for (; i != e; ++i, ++vi)
|
return std::equal(b, e, vb);
|
||||||
if (!(*i == *vi))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user