Boost logo

Boost :

Subject: Re: [boost] [string] Yet another Unicode string class
From: Anders Dalvander (boost_at_[hidden])
Date: 2011-02-14 01:10:57

On 20:59, Dave Abrahams wrote:
> On Thu, Feb 10, 2011 at 3:38 PM, Anders Dalvander<boost_at_[hidden]> wrote:
>> * It is (currently) immutable and shares data, and thus fast to copy.
> Is there a reason you think this is a better approach than you could
> have by using the small string optimization and simply doing a deep
> copy when the internal buffer is too small?

Thanks for your comments.

Actually, the only reason I have for this approach is that I listened,
perhaps too much, to other voices on this list. Voices which said that
immutability was very useful and could provide optimization
possibilities. Currently these potential optimizations are unused,
except when copying the data.

It is very easy to change the design, by changing the single data member
from type `boost::shared_ptr<const std::string>` to `std::string`. That
way the small string optimization, if any, of `std::string` could be
utilized directly.

Come to think of it, the type could actually be specified as a typedef
of the encoding template parameter.

Anders Dalvander


Boost list run by bdawes at, gregod at, cpdaniel at, john at