summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qmap.h')
-rw-r--r--src/corelib/tools/qmap.h44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index a44f0088d3..d3e27f09ef 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -347,8 +347,28 @@ public:
explicit QMap(const typename std::map<Key, T> &other);
std::map<Key, T> toStdMap() const;
- bool operator==(const QMap<Key, T> &other) const;
- inline bool operator!=(const QMap<Key, T> &other) const { return !(*this == other); }
+ template <typename U = T>
+ QTypeTraits::compare_eq_result<U> operator==(const QMap<Key, T> &other) const
+ {
+ if (size() != other.size())
+ return false;
+ if (d == other.d)
+ return true;
+
+ const_iterator it1 = begin();
+ const_iterator it2 = other.begin();
+
+ while (it1 != end()) {
+ if (!(it1.value() == it2.value()) || qMapLessThanKey(it1.key(), it2.key()) || qMapLessThanKey(it2.key(), it1.key()))
+ return false;
+ ++it2;
+ ++it1;
+ }
+ return true;
+ }
+ template <typename U = T>
+ QTypeTraits::compare_eq_result<U> operator!=(const QMap<Key, T> &other) const
+ { return !(*this == other); }
inline qsizetype size() const { return d->size; }
@@ -1045,26 +1065,6 @@ Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::upperBound(const
}
template <class Key, class T>
-Q_OUTOFLINE_TEMPLATE bool QMap<Key, T>::operator==(const QMap<Key, T> &other) const
-{
- if (size() != other.size())
- return false;
- if (d == other.d)
- return true;
-
- const_iterator it1 = begin();
- const_iterator it2 = other.begin();
-
- while (it1 != end()) {
- if (!(it1.value() == it2.value()) || qMapLessThanKey(it1.key(), it2.key()) || qMapLessThanKey(it2.key(), it1.key()))
- return false;
- ++it2;
- ++it1;
- }
- return true;
-}
-
-template <class Key, class T>
Q_OUTOFLINE_TEMPLATE QMap<Key, T>::QMap(const std::map<Key, T> &other)
{
d = QMapData<Key, T>::create();