QFlags<>: let the compiler generate copy ctor/op=
authorMarc Mutz <marc.mutz@kdab.com>
Fri, 24 Feb 2012 16:33:25 +0000 (17:33 +0100)
committerQt by Nokia <qt-info@nokia.com>
Sun, 26 Feb 2012 22:43:10 +0000 (23:43 +0100)
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 <joao.abecasis@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
src/corelib/global/qglobal.h

index 47d56d7..b159a87 100644 (file)
@@ -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; }