Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-25 11:49:40


From: "Alan M. Carroll, CodeSlinger" <yg-boost-users_at_[hidden]>
> I've written my own smart pointer classes but have mostly switched over to
> Boost. What I've wondered is why the Boost smart pointers use various
> methods to achieve this boolean conversion instead of a single method of
the
> form
>
> operator void const * () const { return px; }
>
> This enables the standard boolean uses ("if (ptr)", "if (!ptr)") and also
> allows direct comparison between a raw pointer and the shared pointer. It
> also doesn't seem to allow bad leakage of the pointer because a (void
> const*) can only be used for comparison. I've looked through the news
groups
> and Boost documentation and seen no mention of this.

delete ptr; // ;-)

In the general case unwanted comparisons are a problem, too.


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