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;
|
||||
if (d->size != v.d->size)
|
||||
return false;
|
||||
T* e = d->end();
|
||||
T* i = d->begin();
|
||||
T* vi = v.d->begin();
|
||||
for (; i != e; ++i, ++vi)
|
||||
if (!(*i == *vi))
|
||||
return false;
|
||||
return true;
|
||||
const T *vb = v.d->begin();
|
||||
const T *b = d->begin();
|
||||
const T *e = d->end();
|
||||
return std::equal(b, e, vb);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
Loading…
Reference in New Issue
Block a user