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

operator+ API asymmetries with QStringBuilder

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 6.6
    • None

    Description

      QStringBuilder defines operator% (and operator+ under QT_USE_STRINGBUILDER) between types that normally don't have operator+.

      For the sake of API symmetry, such operator+ overloads should be added when QT_USE_STRINGBUILDER is not available.

      Basically: everything I can write as a % b shall also compile as a + b, with identical semantics.

      Example:

      // not under QT_USE_STRINGBUILDER
      QStringView s;
      s + s;  // error, no such operator
      s % s; // ok
      

      Incomplete list:

      • operator+(QString, QStringView) and reversed
      • operator+(QStringView, QStringView)
      • operator+(QByteArray, QByteArrayView) and reversed
      • operator+(QLatin1StringView, QLatin1StringView)
      • operator+(QLatin1Char, QLatin1Char)
      • operator+(QChar, QChar)

      Probably more. The last two are outright scary and probably warrant a QSB redesign. (Also, concatenating views through operator+ sounds a bit strange.)

      Attachments

        Issue Links

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

          Activity

            People

              thiago Thiago Macieira
              peppe Giuseppe D'Angelo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes