From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-07-20 22:07:38
On Friday 20 July 2001 06:43, you wrote:
> on 7/19/01 2:13 PM, Peter Dimov at pdimov_at_[hidden] wrote:
> > * an implicit conversion to "void const *" allows (?) the object to be
> > used in a delete expression.
> The original guideline was for value types that may need to express some
> Boolean state for "if" or "?:". A "bool" conversion seems best, but C++
> built-in conversion rules would also let the conversion work for "int" and
> the other built-in numeric types. A "void const *" conversion avoids the
> numeric conversions. These values types shouldn't be in a delete
> expression in the first place (without a preceding &), so that worry
> shouldn't matter.
Peter Dimov came up with an excellent solution to this. Instead of a
conversion to void const *, he used a conversion to a member function pointer
which avoids most comparisons (== and != still need to be dealt with).
Boost.Function uses this idiom (see boost/function/function_base.hpp, class
function_base for an example).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk