|
Boost : |
From: Trey Jackson (tjackson_at_[hidden])
Date: 2003-02-06 14:23:17
Peter Dimov wrote:
>Have you tried? ;-)
Nope, I'm afraid I'd mess it up - as in the point below.
>Nope. You still need the counter mutex penalty. See example 2, that modifies
>two different shared_ptr instances, with well defined results. Those two
>instances can well share a count.
Ahhh..., I didn't see that.
point: The reference count is per object allocated, not per pointer.
>Yep. But a well designed program doesn't need this construct. The extra
>overhead would only "help" badly designed programs, but everyone will have
>to pay.
Right, I was still operating under the idea that you could make it
work with just one mutex per shared_ptr.
>I'm pretty sure that there are programs where the unnecessary
>synchronization overhead would be unacceptable. But these cases are much
>rarer than one might think.
Yeah, I'd have thought so too.
But I'm currently sharing the QTs between threads and messed something
up b/c the threaded version (with >1 thread) takes many times as long as
the serial version... And I was tired of having to recompile pretty
much everything in the project b/c I'd changed a basic container.
That's another thread for another group.
>Depends on what you mean by "a technical reason". It is very controversial
>whether the cost of an extra template parameter can be considered a
>technical reason. :-)
Fair enough. Since writing template code is always a struggle between
me and the compiler I can see the desire to avoid adding extra
template parameters.
TJ
-- Trey Jackson tjackson_at_[hidden] "... at this point, the elephant is looking like an irate Roseanne." -- Fran Drescher
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk