Boost logo

Boost Users :

From: Scott Meyers (usenet_at_[hidden])
Date: 2006-05-02 13:00:13


Peter Dimov wrote:
> The reason for p = 0 working in intrusive_ptr's case is that intrusive_ptr
> has an assignment operator taking a raw pointer. The other smart pointer
> types do not.

I understand that, my question was more about why this operation is supported
only for intrusive_ptr.

> The lack of intrusive_ptr::reset is arguably a defect in intrusive_ptr's
> interface. My personal opinion is that moving between shared_ptr and
> intrusive_ptr doesn't have to be smooth because their semantics are
> different enough to warrant a careful code review after the switch. On the
> other hand, consistency does have its benefits.

Substantial benefits, IMO. For example, even if not changing the type of one
smart pointer to another, it's not hard to imagine different smart pointer types
in the same program or one programmer using different smart pointer types in
different code bases. Having to remember which syntax to nullify different
smart pointer types strikes me as a burden without any corresponding benefit.

Scott


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