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

Make Qt ordering types binary-compatible to std::_ordering types

    XMLWordPrintable

Details

    • Task
    • Resolution: Fixed
    • P1: Critical
    • 6.7.0 FF
    • None
    • Core: Other
    • None
    • 5
    • b3819d9cc (dev), 4b6f75702 (dev)
    • Foundations Sprint 94, Foundations Sprint 95, Foundations Sprint 96

    Description

      The QPartialOrdering class was not designed with std::partial_ordering compatibility in mind, and the newly-added QWeakOrdering and QStrongOrdering types inherited the incompatibility.

      It turns out that this is causing problems, in two ways:

      • In C++20, our operations eventually all fall back to built-in operator<=>, which return std types. Our ABIs then return the Qt types for binary compatibility, and a C++20 user then uses op<=> again, potentially comparing with std types again. That makes for at least two conversions, and if they're not trivial (same memory representation between the two sets of types), that introduces value-adjustment code at each conversion step
      • Worse, if the two types are not binary compatible, we can't have helper functions return either std or Qt types depending on the C++ standard we're compiling in, so we'd cement the use of the Qt types until Qt 7, with all the overhead involved in converting between the two.

      Since we can't fix QPartialOrdering, which was added in Qt 6.0, we need to duplicate it, and the Q*Ordering name-space is not available for the new classes.

      Acceptance criteria:

      • New classes Qt:: {partial,weak,strong}

        _ordering are added

        • binary-compatible with the resp. std types
        • for each stdlib!
          • statically asserted to have same memory layout and same numeric values for the states less, greater, {[equal}}, unordered, etc.
      • QPartialOrdering is unchanged, QWeakOrdering and QStrongOrdering are removed again
      • QPartialOrdering retains conversions to/from std and Qt::_ordering types

      Attachments

        Issue Links

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

          Activity

            People

              mmutz Marc Mutz
              mmutz Marc Mutz
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes