$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-11-13 14:17:27
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.
This type is incorrectly designed. Here's why:
T * p = new T;
intrusive_ptr<T> p1( p );
intrusive_ptr<T> p2( p );
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.