summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlist.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r--src/corelib/tools/qlist.h38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 443789b411..35dc286191 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -162,22 +162,10 @@ public:
void swap(QList<T> &other) noexcept { qSwap(d, other.d); }
- template <typename U = T>
- friend QTypeTraits::compare_eq_result<U> operator==(const QList &l, const QList &r)
- {
- if (l.size() != r.size())
- return false;
- if (l.begin() == r.begin())
- return true;
-
- // do element-by-element comparison
- return l.d->compare(l.begin(), r.begin(), l.size());
- }
- template <typename U = T>
- friend QTypeTraits::compare_eq_result<U> operator!=(const QList &l, const QList &r)
- {
- return !(l == r);
- }
+ template <typename U>
+ friend QTypeTraits::compare_eq_result<U> operator==(const QList<U> &l, const QList<U> &r);
+ template <typename U>
+ friend QTypeTraits::compare_eq_result<U> operator!=(const QList<U> &l, const QList<U> &r);
qsizetype size() const noexcept { return d->size; }
qsizetype count() const noexcept { return size(); }
@@ -792,6 +780,24 @@ size_t qHash(const QList<T> &key, size_t seed = 0)
return qHashRange(key.cbegin(), key.cend(), seed);
}
+template <typename U>
+QTypeTraits::compare_eq_result<U> operator==(const QList<U> &l, const QList<U> &r)
+{
+ if (l.size() != r.size())
+ return false;
+ if (l.begin() == r.begin())
+ return true;
+
+ // do element-by-element comparison
+ return l.d->compare(l.begin(), r.begin(), l.size());
+}
+
+template <typename U>
+QTypeTraits::compare_eq_result<U> operator!=(const QList<U> &l, const QList<U> &r)
+{
+ return !(l == r);
+}
+
template <typename T>
auto operator<(const QList<T> &lhs, const QList<T> &rhs)
noexcept(noexcept(std::lexicographical_compare(lhs.begin(), lhs.end(),