QMetaMethod: Make comparison operators hidden friends

Reduce ADL noise.

Change-Id: Ic747c2d76b7ce66b222e08eeaf6f1d193ba99f81
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-10-27 23:53:31 +01:00
parent 5866b82e24
commit 2222e695fc
2 changed files with 6 additions and 11 deletions

View File

@ -1640,18 +1640,16 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *
invoked), otherwise returns \c false. invoked), otherwise returns \c false.
*/ */
/*! \fn bool operator==(const QMetaMethod &m1, const QMetaMethod &m2) /*! \fn bool QMetaMethod::operator==(const QMetaMethod &m1, const QMetaMethod &m2)
\since 5.0 \since 5.0
\relates QMetaMethod
\overload \overload
Returns \c true if method \a m1 is equal to method \a m2, Returns \c true if method \a m1 is equal to method \a m2,
otherwise returns \c false. otherwise returns \c false.
*/ */
/*! \fn bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2) /*! \fn bool QMetaMethod::operator!=(const QMetaMethod &m1, const QMetaMethod &m2)
\since 5.0 \since 5.0
\relates QMetaMethod
\overload \overload
Returns \c true if method \a m1 is not equal to method \a m2, Returns \c true if method \a m1 is not equal to method \a m2,

View File

@ -208,16 +208,13 @@ private:
friend struct QMetaObject; friend struct QMetaObject;
friend struct QMetaObjectPrivate; friend struct QMetaObjectPrivate;
friend class QObject; friend class QObject;
friend bool operator==(const QMetaMethod &m1, const QMetaMethod &m2); friend bool operator==(const QMetaMethod &m1, const QMetaMethod &m2) noexcept
friend bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2); { return m1.data == m2.data; }
friend bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2) noexcept
{ return !(m1 == m2); }
}; };
Q_DECLARE_TYPEINFO(QMetaMethod, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(QMetaMethod, Q_MOVABLE_TYPE);
inline bool operator==(const QMetaMethod &m1, const QMetaMethod &m2)
{ return m1.data == m2.data; }
inline bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2)
{ return !(m1 == m2); }
class Q_CORE_EXPORT QMetaEnum class Q_CORE_EXPORT QMetaEnum
{ {
public: public: