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

QMap::operator[] const return type

    XMLWordPrintable

Details

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

    Description

      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;
      }

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes