
12 Aug
2010
12 Aug
'10
1:29 p.m.
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.