|
Boost Users : |
From: Bruno Martínez (br1_at_[hidden])
Date: 2005-11-13 17:57:44
On Sun, 13 Nov 2005 17:17:27 -0200, Peter Dimov <pdimov_at_[hidden]> wrote:
> Bruno Martínez wrote:
>> Hi.
>>
>> intrusive_ptr's constructor takes an bool to signal whether the
>> refcount should be initially incremented or not. The default is true.
>>
>> I find that the default is different for different types, [...]
>
> No, it shouldn't be. I suspect that you have in mind a type whose initial
> reference count is one instead of zero.
You are right.
> This type is incorrectly designed. Here's why:
>
> T * p = new T;
> intrusive_ptr<T> p1( p );
> intrusive_ptr<T> p2( p );
I agree. There's nothing I can do to change the type, tough.
> Note that, in order to be able to reliably create an intrusive_ptr from a
> raw pointer (a unique selling point for intrusive counting,) the initial
> reference count needs to be zero.
In my case, I never use that feature. All my intrusive_ptr are
constructed with a false second argument.
I wasn't aware that intrusive_ptr's constructor was implicit, though. It
seems thing should be left as they are now.
Thanks,
Bruno
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net