Boost logo

Boost Users :

Subject: Re: [Boost-users] [smart_ptr]intrusive_ptr suggestion
From: Andrew Holden (aholden_at_[hidden])
Date: 2010-08-12 09:29:54

On August 11, 2010 5:35 PM, gast128 wrote:
> <snip>
>> Perhaps you should initialize the reference count to zero in the
>> constructor of IFoo, instead of initializing it to 1.
>> In Christ,
>> Steven Watanabe
> Yes but I think it is more natural that the ref count starts at 1 for a ref counted object. Thats at least the COM protocol

It's a slightly different situation. COM is designed for manual reference counting. It assumes that each raw pointer, including the one returned from the constructor, counts as a reference. For boost intrusive pointers, the count is the number of intrusive pointers referencing the object. Until you assign the object to one, that count is zero.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at