From aa38ab8f689b315061b3277422e0e9261512b0bf Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 22 Oct 2020 16:33:41 +0200 Subject: [PATCH] Make Q(Multi)Map equality operators documentation-friendly Change-Id: I1a84c437bb19dd3c667596c59e1404bbbf39978e Reviewed-by: Paul Wicking --- src/corelib/tools/qmap.h | 15 ++++++++++++++- src/corelib/tools/qmap.qdoc | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 72926179044..0030c076ad3 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -272,12 +272,18 @@ public: return {}; } +#ifdef Q_QDOC + template + friend bool operator==(const QMap &lhs, const QMap &rhs); + template + friend bool operator!=(const QMap &lhs, const QMap &rhs); +#else // CHANGE: non-member equality comparison template friend QTypeTraits::compare_eq_result operator==(const QMap &lhs, const QMap &rhs); template friend QTypeTraits::compare_eq_result operator!=(const QMap &lhs, const QMap &rhs); - +#endif // TODO: add the other comparison operators; std::map has them. size_type size() const { return d ? size_type(d->m.size()) : size_type(0); } @@ -842,11 +848,18 @@ public: return {}; } +#ifdef Q_QDOC + template + friend bool operator==(const QMultiMap &lhs, const QMultiMap &rhs); + template + friend bool operator!=(const QMultiMap &lhs, const QMultiMap &rhs); +#else // CHANGE: non-member equality comparison template friend QTypeTraits::compare_eq_result operator==(const QMultiMap &lhs, const QMultiMap &rhs); template friend QTypeTraits::compare_eq_result operator!=(const QMultiMap &lhs, const QMultiMap &rhs); +#endif // TODO: add the other comparison operators; std::multimap has them. diff --git a/src/corelib/tools/qmap.qdoc b/src/corelib/tools/qmap.qdoc index b2ec6e15e46..79b3cc155da 100644 --- a/src/corelib/tools/qmap.qdoc +++ b/src/corelib/tools/qmap.qdoc @@ -249,7 +249,7 @@ Returns an STL map equivalent to this QMap. */ -/*! \fn template bool operator==(const QMap &lhs, const QMap &rhs) const +/*! \fn template bool operator==(const QMap &lhs, const QMap &rhs) \relates QMap Returns \c true if \a lhs is equal to \a rhs; otherwise returns @@ -264,7 +264,7 @@ \sa operator!=() */ -/*! \fn template bool operator!=(const QMap &lhs, const QMap &rhs) const +/*! \fn template bool operator!=(const QMap &lhs, const QMap &rhs) \relates QMap Returns \c true if \a lhs is not equal to \a rhs; otherwise returns