Georg Baum wrote:
Am Sonntag, 29. Oktober 2006 20:48 schrieb Abdelrazak Younes:
I think speed wise it will be very efficient. Memory wise, well the
length is indeed multiplied by 6 but the actual data size increase is
less than that. If N is the number of unicode char, the ucs4 version
would occupy 4xN bytes exactly and the utf8 would contain 6xN bytes at
most. So it is only a 50% increase. Resizing a string to a lower size is
cheap.
That means that no copying happens?
Yes.
I am always unsure about that with
strings, because I normally do numerics.
The standard says that resizing to a lower size guarantee that (same as
std::vector by the way).
Then it would probably be a good
idea indeed. The only question I have then is this: Why did Lars not do
this from the beginning?
I _don't_ know. Don't you remember the lengthy discussion about
docstring versus vector<char_type>?
IIRC he said something about all the intermediate data copying not being
important.
Abdel.