diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-10-30 15:23:52 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-10-30 17:29:45 +0100 |
commit | d017baac8993757c035d5ba2829e88e946c169cc (patch) | |
tree | a231ab711241b7d6981de83d1587479efaadcb34 /src/opengl/qopenglversionprofile.h | |
parent | a5ce712d6b300e01664fec8a682daa04b7a3d099 (diff) |
Hide comparison operators for QtOpenGLVersion types from ADL
Make hidden friends. Also add noexcept.
No documentation to adjust.
Fixes: QTBUG-87978
Change-Id: I6e757b7c37fb8aabdfd395ab057a84696104e640
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/opengl/qopenglversionprofile.h')
-rw-r--r-- | src/opengl/qopenglversionprofile.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/opengl/qopenglversionprofile.h b/src/opengl/qopenglversionprofile.h index 3ddd3dc8e9..e207548dd6 100644 --- a/src/opengl/qopenglversionprofile.h +++ b/src/opengl/qopenglversionprofile.h @@ -74,25 +74,26 @@ public: private: QOpenGLVersionProfilePrivate* d; + + friend bool operator==(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs) noexcept + { + if (lhs.profile() != rhs.profile()) + return false; + return lhs.version() == rhs.version(); + } + + friend bool operator!=(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs) noexcept + { + return !operator==(lhs, rhs); + } }; -inline size_t qHash(const QOpenGLVersionProfile &v, size_t seed = 0) +inline size_t qHash(const QOpenGLVersionProfile &v, size_t seed = 0) noexcept { return qHash(static_cast<int>(v.profile() * 1000) + v.version().first * 100 + v.version().second * 10, seed); } -inline bool operator==(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs) -{ - if (lhs.profile() != rhs.profile()) - return false; - return lhs.version() == rhs.version(); -} - -inline bool operator!=(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs) -{ - return !operator==(lhs, rhs); -} #ifndef QT_NO_DEBUG_STREAM Q_OPENGL_EXPORT QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp); |