Boost logo

Boost :

From: Doug Gregor (gregod_at_[hidden])
Date: 2001-04-10 07:30:25


On Tuesday 10 April 2001 07:49, you wrote:
> Due to the automatic conversion to const void *,
> the following code is valid to BC++ 5.5. GCC 2.95.2
> produces (only) a warning:
>
> #include <boost/any_function.hpp>
>
> int main()
> {
> boost::any_function<void> f;
> delete f;
> }
>
> Should this be possible or not?
>
> Note that although MSVC++ 6 errors out on this,
> MSVC++ 7 does allow it.

This is an unfortunate side effect :(. The operator bool vs. operator const
void* debate has been brought up many times, and I am still not fully decided
on how it should be handled. Perhaps the best way is just to use operator
bool but with many dead-end declarations so that the user cannot use any of
the operators, i.e.,
template<...>
bool operator==(const any_function<...>&, const any_function<...>&);

        Doug


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