Define friend functions of QSslEllipticCurve outside of class

Define both qHash() and operator==() outside of the class, like
it is already done for operator!=(). Defining it inside the
class limits it to argument-dependent lookup, which in turn
means that the lookup rules for operator!= and operator==
were slightly different (e.g. if one would compare variables
of a type that is implicitly convertible to QSslEllipticCurve).

As a side-effect, this also fixes a qdoc warning.

Change-Id: I40ab2f8cd2b6b5f42481dd254229a88b678f3f15
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Kai Koehne 2015-07-01 14:08:07 +02:00
parent f2634c3a48
commit 0dd14aaaf1

View File

@ -68,10 +68,8 @@ public:
private: private:
int id; int id;
friend Q_DECL_CONSTEXPR bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW friend Q_DECL_CONSTEXPR bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW;
{ return lhs.id == rhs.id; } friend Q_DECL_CONSTEXPR uint qHash(QSslEllipticCurve curve, uint seed) Q_DECL_NOTHROW;
friend Q_DECL_CONSTEXPR uint qHash(QSslEllipticCurve curve, uint seed) Q_DECL_NOTHROW
{ return qHash(curve.id, seed); }
friend class QSslSocketPrivate; friend class QSslSocketPrivate;
friend class QSslSocketBackendPrivate; friend class QSslSocketBackendPrivate;
@ -79,6 +77,12 @@ private:
Q_DECLARE_TYPEINFO(QSslEllipticCurve, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QSslEllipticCurve, Q_PRIMITIVE_TYPE);
Q_DECL_CONSTEXPR inline uint qHash(QSslEllipticCurve curve, uint seed) Q_DECL_NOTHROW
{ return qHash(curve.id, seed); }
Q_DECL_CONSTEXPR inline bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW
{ return lhs.id == rhs.id; }
Q_DECL_CONSTEXPR inline bool operator!=(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW Q_DECL_CONSTEXPR inline bool operator!=(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW
{ return !operator==(lhs, rhs); } { return !operator==(lhs, rhs); }