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

As a user of QStringBuilder, I would like the system to pin down rvalues, like QStringTokenizer does

    XMLWordPrintable

Details

    Description

      In our projects, we use the AAA (almost-always auto) style, which gives us trouble when we enable QStringBuilder:

      // without QStringBuilder:
      auto s2 = s + QString::fromLatin1("foo"); // ok, s2 is a QString
      label.setText(s2);
      // with QStringBuilder
      auto s2 = s + QString::fromLatin1("foo"); // oops, s2 is a QStringBuilder<QString, QString>
      // temporary returned fromLatin1() destroyed now
      label.setText(s2); // conversion to actual QString here, accesses deleted data
      

      I like how QStringTokenizer doesn't have this problem, and I think the same technique used there can also be used in QStringBuilder.

      Attachments

        Issue Links

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

          Activity

            People

              vladimirbelyavsky Vladimir Belyavsky
              mmutz Marc Mutz
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes