Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2003-05-23 09:38:27


Peter Dimov wrote:
>
> Alexander Terekhov wrote:
> > Try to convince Dimov that policy-based designs/interfaces aren't
> > that bad; and that, in general, the stuff managed by smart pointers
> > isn't necessarily process-wide/thread-shared stuff "by default"...
> > like global heap, current working directory, etc.
>
> Policy based designs aren't bad. It's just that when I look at
> boost::shared_ptr I see std::shared_ptr. The existing practice is that
> things in the standard library are as thread safe as an int "by default".
> Nobody complains that std::string should have a threading model parameter
> since it can be (much) more efficient if it's only accessed from a single
> thread.

Nobody complains? Well, that's only because I don't use std::string. ;-)

http://groups.google.com/groups?selm=3D774CA9.4D9491FE%40web.de
(Subject: Re: Ref-counted strings not thread-safe -- looking for clarification)

<quote>

Matthew Austern wrote:
[...]
> (The main reason some implementations avoid reference counting
> is that, in the presence of threads, it's much harder to get
> things to work correctly if you use refcounting. As you've
> found.)

Just a few ideas/food for thought:

immutable_string< ...,
                  class thread_sharing_policy_for_representation =
                   /* -pthread option: shared/private by default */ >

string< ...,
        class thread_sharing_policy_for_representation =
           /* -pthread option: shared/private by default */ >


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