Details
-
Epic
-
Resolution: Duplicate
-
P3: Somewhat important
-
None
-
None
-
None
-
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
- duplicates
-
QTBUG-53264 Support C++11 move semantics where applicable
- Open