Boost logo

Boost :

Subject: Re: [boost] [string] proposal
From: Eric Niebler (eric_at_[hidden])
Date: 2011-01-21 08:23:44


On 1/21/2011 7:45 PM, Dean Michael Berris wrote:
> On Fri, Jan 21, 2011 at 8:37 PM, Eric Niebler <eric_at_[hidden]> wrote:
>> On 1/21/2011 7:07 PM, Dean Michael Berris wrote:
>>> Mostly I'm interested in seeing a string class that is:
>>>
>>> 1. Immutable. No if's or but's about it. I don't want a string to be
>>> modifiable. Period. You can create it, and once it's created, that's
>>> it.
>>>
>>> 2. Has real value semantics. This means, once you've copied it, that's
>>> really copied. No funky copy-on-write reference-counting mumbo-jumbo.
>>
>> Uh, if the string is immutable, then two strings can transparently share
>> the same data. There is no "write" in "copy-on-write". That's the
>> definition of immutable. :-)
>
> Ha! You're right. :D Now if you can make this work without reference
> counting, that'd be perfect. :D

Why? Immutable data is exactly the situation (and the only situation
IMO) when you'd want to share data. The potential savings, both in time
and space, are huge. What's wrong with a ref-counted string impl?

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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