From 2a771cef4a939d26f6ffc45caa690330b33882c9 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 24 Feb 2012 17:33:25 +0100 Subject: [PATCH] QFlags<>: let the compiler generate copy ctor/op= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The user-defined copy constructor and copy-assignment operators were 100% equivalent to the ones the compiler would generate, so let the compiler generate them (so we reap move constructors, too, even though they're not needed on this class). Change-Id: Iecdd579fa5a819d083ec9b2f25734ddba85515e6 Reviewed-by: João Abecasis Reviewed-by: Olivier Goffart --- src/corelib/global/qglobal.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 47d56d7c1b..b159a877b7 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1225,12 +1225,15 @@ class QFlags int i; public: typedef Enum enum_type; - Q_DECL_CONSTEXPR inline QFlags(const QFlags &f) : i(f.i) {} + // compiler-generated copy/move ctor/assignment operators are fine! +#ifdef qdoc + inline QFlags(const QFlags &other); + inline QFlags &operator=(const QFlags &other); +#endif Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(f) {} Q_DECL_CONSTEXPR inline QFlags(Zero = 0) : i(0) {} inline QFlags(QFlag f) : i(f) {} - inline QFlags &operator=(const QFlags &f) { i = f.i; return *this; } inline QFlags &operator&=(int mask) { i &= mask; return *this; } inline QFlags &operator&=(uint mask) { i &= mask; return *this; } inline QFlags &operator|=(QFlags f) { i |= f.i; return *this; }