diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-20 09:32:05 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-11-24 09:11:05 +0000 |
commit | 27f08ab49479b1cbd3f99e28cbe8b0a89a23bd10 (patch) | |
tree | dcf574591b60011268eafd3ffbc866c8a5ed004c /src/corelib/global/qglobal.cpp | |
parent | 079df681ec546bd3d644efabc90604708cecadff (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.cpp')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 046d4b7b2a..8da94c8624 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -525,6 +525,31 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value)); made private. In that case, no error would be reported, but your application would probably crash when you called a member function of \c{w}. + + \sa Q_DISABLE_COPY_MOVE, Q_DISABLE_MOVE +*/ + +/*! + \macro Q_DISABLE_MOVE(Class) + \relates QObject + + Disables the use of move constructors and move assignment operators + for the given \a Class. + + \sa Q_DISABLE_COPY, Q_DISABLE_COPY_MOVE + \since 5.13 +*/ + +/*! + \macro Q_DISABLE_COPY_MOVE(Class) + \relates QObject + + A convenience macro that disables the use of copy constructors, assignment + operators, move constructors and move assignment operators for the given + \a Class, combining Q_DISABLE_COPY and Q_DISABLE_MOVE. + + \sa Q_DISABLE_COPY, Q_DISABLE_MOVE + \since 5.13 */ /*! |