Boost logo

Boost :

From: Joseph Gauterin (joseph.gauterin_at_[hidden])
Date: 2007-09-27 12:31:53


>> Variable-width-encoded strings should be fairly straightforward when they
>> are immutable, but will probably get hairy when they can be modified.
>True. I think the strings should be immutable. I think experience with
>Java and C# compared to C++ shows that an immutable string class is
>superior in most use cases

I also agree that immutable strings are the way forward for VWEs.

If we had mutable strings consider how badly the following would perform:
std::replace(utfString.begin(),utfString.end(),SingleByteChar,MultiByteChar);

Although this looks O(n) at first glance, it's actually O(n^2), as the
container has to expand itself for every replacement. I don't think a
library should make writing worst case scenario type code that easy.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk