
6 Mar
2006
6 Mar
'06
5:30 p.m.
But I think that filling a string instead of returning a temporary one is always faster. And there is another reason for avoiding allocation apart from speed: memory fragmentation.
Something not yet mentioned in this thread - the Qt QString provides a reference-counted "shallow-copy", (deep-copy on modification) mechanism that makes QString a lot more efficient than std::string in this kind of situation. Copying a QString is cheap, and sizeof(QString)==sizeof(int). Has there been any boost proposal for alternative strings to std::string? Nigel