Details
-
Type:
User Story
-
Status: Open
-
Priority:
P2: Important
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Core: QString and Unicode
-
Labels:None
-
Epic Link:
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.