Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2000-03-17 17:34:32


> 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.

The impasse is that some users of smart pointers, myself
included, actually want operator T*(). If you have generic
code written to accept pointers then operator void*() won't
do, and neither will get().


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