Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2005-05-21 17:48:23


Jean-François Brouillet <verec_at_[hidden]> writes:

>>>> What is the name you would choose for the "addRef" parameter?
>>>> "managed" ? Or maybe, simply "addRef" after all, since you
>>>> would _assume_ by virtue of the symmetric behaviour of a destructor
>>>> w.r.t a constructor, that whatever the constructor does, the
>>>> destructor un-does it, and whatever the constructor does NOT do,
>>>> the destructor does NOT un-do.
>>
>> Bad assumption with smart pointers. Ctors don't allocate
>> resources, yet dtors deallocate them.
>
> Which might only indicate that they are not so "smart" after
> all... ;-)

Clever quips aside, it indicates that your design principle doesn't
generalize.

If you're arguing that the design of intrusive_ptr should be changed,
the basic idea that smart pointers take over management of
already-allocated resources must be "smart" enough for you. Whatever
specific change you're arguing for may have merit, but not on the
basis of ctor/dtor symmetry.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net