On Sun, 13 Nov 2005 17:17:27 -0200, Peter Dimov
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