Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-53264

Support C++11 move semantics where applicable

XMLWordPrintable

    • Icon: Epic Epic
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • None
    • Core: Other, Other
    • None
    • C++11 Move Semantics
    • c1c06971e (dev), 3840657da (dev), 62835eeb2 (6.10), bd73d3887 (6.10)

      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

        For Gerrit Dashboard: QTBUG-53264
        # Subject Branch Project Status CR V

            cnn Qt Core & Network
            mmutz Marc Mutz
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                There is 1 open Gerrit change