Remove QArrayDataOps::compare()

Replace the only usage in QList with std::equal().

Change-Id: I2176b51a2943e0523073a435484a53a1c4ecb635
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 71a1f7c1ea2d11c5e84be5c9956f70c609bb8ebe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ivan Solovev 2024-07-23 18:42:41 +02:00 committed by Qt Cherry-pick Bot
parent ceaf5b9a2b
commit 61ae6f1c8a
2 changed files with 1 additions and 14 deletions

View File

@ -270,12 +270,6 @@ public:
::memcpy(static_cast<void *>(b++), static_cast<const void *>(&t), sizeof(T));
}
bool compare(const T *begin1, const T *begin2, size_t n) const
{
const T *end1 = begin1 + n;
return std::equal(begin1, end1, begin2);
}
void reallocate(qsizetype alloc, QArrayData::AllocationOption option)
{
auto pair = Data::reallocateUnaligned(this->d, this->ptr, alloc, option);
@ -646,12 +640,6 @@ public:
while (b != e)
*b++ = t;
}
bool compare(const T *begin1, const T *begin2, size_t n) const
{
const T *end1 = begin1 + n;
return std::equal(begin1, end1, begin2);
}
};
template <class T>
@ -889,7 +877,6 @@ public:
// using Base::truncate;
// using Base::destroyAll;
// using Base::assign;
// using Base::compare;
template<typename It>
void appendIteratorRange(It b, It e, QtPrivate::IfIsForwardIterator<It> = true)

View File

@ -347,7 +347,7 @@ public:
return true;
// do element-by-element comparison
return d->compare(data(), other.data(), size());
return std::equal(begin(), end(), other.begin(), other.end());
}
template <typename U = T>
QTypeTraits::compare_eq_result_container<QList, U> operator!=(const QList &other) const