Details
-
Epic
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
None
-
None
-
C++11 Move Semantics
Description
DL;DR: all copyable Qt classes should be (nothrow-)movable
To this day (Qt 6.4), there are still Qt classes which have a user-defined copy Special Member Functions (SMFs), preventing implicit generation of move SMFs. These types are therefore not movable, in particular, they're not nothrow_move_
{constructible,assignable}, so they perform more poorly than they could in many situations, such as returning from functions and reallocation of containers.
Add move SMFs, possibly member-swap and free swap functions (by using Q_DECLARE_SHARED, if that's BC these days) to all copyable classes.
Acceptance criteria: For each copyable class C:
- either C
- is nothrow move-constructible
- is nothrow move-assignable
- has a nothrow member-swap
- has a nothrow ADL (free function) swap
- Q_DECLARE_SHARED provides that
- or
- has a code comment explaining why it doesn't
Attachments
Issue Links
- is duplicated by
-
QTBUG-104522 Complete addition of C++11 move semantics to Qt APIs
- Withdrawn
- links to
-
qt_Essentials_qtcore_dev_linux:SV322 warning: Qt-RuleOfThree: Class with move assignment operator is missing move constructor. [QMimeType]
Gerrit Reviews
For Gerrit Dashboard: QTBUG-53264 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
587652,2 | QAuthenticator: add move SMFs, member-swap, Q_DECALRE_SHARED | dev | qt/qtbase | Status: NEW | -1 | 0 |