QPointer: make swap(lhs, rhs) a hidden friend

This is how we like our free functions these days.

Task-number: QTBUG-87973
Change-Id: I55b5f2674d24c7b76b8dc425a4f1c5520b8c1ec4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Marc Mutz 2023-10-02 17:49:19 +02:00
parent aeeb77650f
commit 1ba4f73692
1 changed files with 3 additions and 4 deletions

View File

@ -77,6 +77,9 @@ public:
inline void clear()
{ wp.clear(); }
friend void swap(QPointer &lhs, QPointer &rhs) noexcept
{ lhs.swap(rhs); }
#define DECLARE_COMPARE_SET(T1, A1, T2, A2) \
friend bool operator==(T1, T2) \
{ return A1 == A2; } \
@ -109,10 +112,6 @@ qPointerFromVariant(const QVariant &variant)
return QPointer<T>{qobject_cast<T*>(QtPrivate::EnableInternalData::internalData(wp))};
}
template <class T>
inline void swap(QPointer<T> &p1, QPointer<T> &p2) noexcept
{ p1.swap(p2); }
QT_END_NAMESPACE
#endif // QT_NO_QOBJECT