Boost logo

Boost :

From: Kevin Atkinson (kevinatk_at_[hidden])
Date: 2000-03-17 18:01:42


On Fri, 17 Mar 2000, Miki Jovanovic wrote:

> Some time ago, somebody raised the issue about implicit casts. And I
> liked the idea very much. But since then the conversation died out and
> nothing happened.
>
> The idea was that the implicit casts like:
>
> operator T*() const throw() { return ptr; }
>
> be replaced with:
>
> operator void*() const throw() { return ptr; }
>
> The reason is that such a pointer can be checked for NULLness, can be
> assigned to other void*'s, but cannot be dereferenced by accident. In
> addition, it will make all our smart pointers nicer, because the
> BOOST_SMART_PTR_CONVERSION define will be a non-issue any more.
>
> I have not heard any strong voices against this, so unless somebody has
> a good argument against, I would like to propose this change to all our
> smart pointers.

Let me put a strong voice against it. I think an implicit conversion to a
pointer is generally safe and I use it all the time. Since the conversion
from a pointer to a smart pointer is made explicit.

---
Kevin Atkinson
kevinatk_at_[hidden]
http://metalab.unc.edu/kevina/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk