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

      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.

        For Gerrit Dashboard: QTBUG-99291
        # Subject Branch Project Status CR V

            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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes