13 Nov
2005
13 Nov
'05
7:17 p.m.
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.