From be10808279c18e7ca8728393921431b74e88433e Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 28 Oct 2020 10:02:48 +0100 Subject: Make QAccessible::State's equality operator a hidden friend Reduce ADL nose. We already have an inline default constructor calling memset, so can have the comparison operator calling memcmp also inlined. Task-number: QTBUG-87973 Change-Id: If8e0ae98b0c44fc3fddac7ef57c5ff021c80dad6 Reviewed-by: Allan Sandfeld Jensen --- src/gui/accessible/qaccessible.cpp | 6 ------ src/gui/accessible/qaccessible.h | 6 ++++-- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'src/gui/accessible') diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index e615dd8cb0..f2bc48fd0c 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -1820,12 +1820,6 @@ const char *qAccessibleEventString(QAccessible::Event event) return QAccessible::staticMetaObject.enumerator(eventEnum).valueToKey(event); } -/*! \internal */ -bool operator==(const QAccessible::State &first, const QAccessible::State &second) -{ - return memcmp(&first, &second, sizeof(QAccessible::State)) == 0; -} - #ifndef QT_NO_DEBUG_STREAM /*! \internal */ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface) diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 5feb562234..093a48e211 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -217,6 +217,10 @@ public: State() { memset(this, 0, sizeof(State)); } + friend inline bool operator==(const QAccessible::State &first, const QAccessible::State &second) + { + return memcmp(&first, &second, sizeof(QAccessible::State)) == 0; + } }; @@ -437,8 +441,6 @@ private: friend class QAccessibleCache; }; -Q_GUI_EXPORT bool operator==(const QAccessible::State &first, const QAccessible::State &second); - Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::Relation) class QAccessible2Interface; -- cgit v1.2.3