From 61ae6f1c8a0961a9b445af8f1917c76f99e92ff2 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Tue, 23 Jul 2024 18:42:41 +0200 Subject: [PATCH] Remove QArrayDataOps::compare() Replace the only usage in QList with std::equal(). Change-Id: I2176b51a2943e0523073a435484a53a1c4ecb635 Reviewed-by: Thiago Macieira (cherry picked from commit 71a1f7c1ea2d11c5e84be5c9956f70c609bb8ebe) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/tools/qarraydataops.h | 13 ------------- src/corelib/tools/qlist.h | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index 7eca084f9a7..d3d22ec087c 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -270,12 +270,6 @@ public: ::memcpy(static_cast(b++), static_cast(&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 @@ -889,7 +877,6 @@ public: // using Base::truncate; // using Base::destroyAll; // using Base::assign; - // using Base::compare; template void appendIteratorRange(It b, It e, QtPrivate::IfIsForwardIterator = true) diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 1cced5acc2d..35dffaa775c 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -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 QTypeTraits::compare_eq_result_container operator!=(const QList &other) const