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

QSharedDataPointer, QExplicitlySharedDataPointer don't provide operator< and friends

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.8.2, 5.0.0
    • None

    Description

      Both QSharedDataPointer and QExplicitlySharedDataPointer don't provide operator<, which makes it harder to use them as replacements to ordinary pointers for example when used as keys in QMap. Worse, they do provide operator bool, so code that uses Q[Explicitly]SharedDataPointer as a key in QMap compiles (at least in gcc 4.5.3), but behaves unexpectedly, because the pointers coerce to bool and are then compared as equal in most cases.

      I haven't checked it, but QHash<Q[Explicitly]SharedDataPointer, T> may suffer from similar problem as qHash( Q[Explicitly]SharedDataPointer<U> ) doesn't seem to be provided.

      It would be nice if the operators could be added for Qt 5 so that users don't need to create work-arounds.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            biochimia João Abecasis
            strohel Matěj Laitl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes