Date: 2004-10-20 16:18:38
Peter Dimov wrote:
> Colin Rafferty wrote:
>> Shouldn't the constructor in intrusive_ptr be explicit?
> No, the constructor is implicit by design. Do you have a case where the
> implicit constructor causes problems?
Sure, this is the same problem as for shared_ptr<>.
extern void foo(const intrusive_ptr<Bar>&);
Bar* bar = new Bar;
foo(bar); // oops!
I thought I was passing a raw pointer into foo(), but I'm actually
creating a temporary intrusive_ptr<Bar>, passing that in, and then
destroying the temporary and the pointer.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk