On Fri, Oct 22, 2010 at 3:17 AM, Kim Gräsman <[email protected]> wrote:
> Hi Dean,
>
> On Thu, Oct 21, 2010 at 06:34, Dean Michael Berris
> <[email protected]> wrote:
>>
>>> So, I think there's merit to not expecting COW from std::string.
>>>
>>
>> Yup, but I haven't been writing cpp-netlib to expect COW. I just think
>> that removing copies can be done later on. ;)
>
> Right, I just wanted to make sure you were aware of the reputation of
> std::string with COW. It's not great ;-)
>

Yeah, I've been bitten by those bugs too. :D

> That said, maybe it's not such a bad idea. Multiple threads make it
> harder to get right, but perhaps not intrinsically worse than heap
> allocation + copy. I'll have to mull on that for a while.
>

Yup, it's no worse than an allocation + copy. You can't do the
allocation and copy atomically either, which means the overhead of
locking and things like that may be higher than the cost of COW.

Someday when my development machine, time, and other things permit, I
might work on an immutable string class -- similar to what the D
programming language has -- as a replacement to std::string. Although
std::string is the standard, I don't mind writing a better string
class at some point that "does the right thing".

Alas, I'm dealing with the SNAFU that is upgrading Ubuntu 10.04 to
10.10. nvidia+xorg-1.9 do not play nice yet. :(

-- 
Dean Michael Berris
deanberris.com

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Cpp-netlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel

Reply via email to