Details
-
Type:
User Story
-
Status: Open
-
Priority:
P3: Somewhat important
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Core: QString and Unicode
-
Labels:None
-
Epic Link:
Description
For conditionals, we currently work around the lack of this feature by using the ternary operator nested within the QStringBuilder expression:
QStringView foo = ~~~; QString s = str1 % ~~~~ % (shouldIncludeFoo ? foo : u"") % ~~~~ ;
But this requires the LHS and RHS of the ternary to have a reasonably-identical type. I cannot add a QL1S in one and a QStringView in the other, let alone QStringBuilder<T,S> for differing T, S.
I'm not sure whether one could just overload the ternary operator for QStringBuilder<>, but that would probably mean that at least one of the legs has to be a QStringBuilder expression itself, so maybe something more explicit is needed, like QStringBuilder::Conditional(cond, lhs, rhs)?
For repetition we don't have any work-around, except storing a subexpression in QString and then using QString::repeated().
Attachments
Issue Links
- clones
-
QTBUG-99300 As a user of QStringBuilder, I would like to have a type-erased container of QStringBuilder expressions
-
- Open
-