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

QMap::operator[] const return type

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.6.2
    • None
    • all

      now
      const T QMap::operator[](const Key&) const

      Why not
      const T& QMap::operator[](const Key&) const

      every time copy constructor for T called just because QMap is const.

      I read code.
      >return T();

      so may be throwing exception (QList - like) would be beter choise.

      or something like
      const T& QMap::globalInvalid()
      {
      static T invalid();
      return invalid;
      }

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

            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            setosha Anton Sergunov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes