> It's anyones guess which will use more memory. In the worst case, for
> LString, an LString would use 6 extra bytes per chunk. Not much of an
> arguement against LString but possibly a better arguement against a
> string<> implementation that uses power of 2 memory allocation.
Academic sidenote:
If you don't double the memory allocation every time you run out of place, you
will not get amortized linear time concatenation.
You *have* to exactly double the memory in order to ensure this - otherwise,
your concatenation operation will be O(n*n), or worse!
In practice, this problem is only exposed with some special concatenation
patterns, so we might not have a problem with the current semantics. But it's
worth trying to change our own implementation to do this, and see if things
improve.
Notice that the memory waste is never more than a constant factor of 2, which
we should be able to handle.
Greets,
Asger