summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobal.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-20 09:32:05 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-11-24 09:11:05 +0000
commit27f08ab49479b1cbd3f99e28cbe8b0a89a23bd10 (patch)
treedcf574591b60011268eafd3ffbc866c8a5ed004c /src/corelib/global/qglobal.h
parent079df681ec546bd3d644efabc90604708cecadff (diff)
Long live Q_DISABLE_COPY_MOVE!
When using Q_DISABLE_COPY, clang-tidy reports: warning: class 'Foo' defines a non-default destructor, a copy constructor and a copy assignment operator but does not define a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions] Add convenience macros to suppress move constructor/assignment as well. [ChangeLog][QtCore] Added macros Q_DISABLE_MOVE and Q_DISABLE_COPY_MOVE complementing Q_DISABLE_COPY. Change-Id: I0b07495ef4ef06c714f7368c706168613c3fe7bc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/global/qglobal.h')
-rw-r--r--src/corelib/global/qglobal.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 8680742c94..e3073d80ec 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -372,6 +372,14 @@ typedef double qreal;
Class(const Class &) Q_DECL_EQ_DELETE;\
Class &operator=(const Class &) Q_DECL_EQ_DELETE;
+#define Q_DISABLE_MOVE(Class) \
+ Class(Class &&) = delete; \
+ Class &operator=(Class &&) = delete;
+
+#define Q_DISABLE_COPY_MOVE(Class) \
+ Q_DISABLE_COPY(Class) \
+ Q_DISABLE_MOVE(Class)
+
/*
No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols
for Qt's internal unit tests. If you want slower loading times and more