Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-06-27 07:49:14


On Wednesday 27 June 2001 06:54, you wrote:
> Doug,
>
> Is the BOOST_WEAK_CONVERSION_OPERATORS really necessary: as far as I can
> tell only the Borland compiler requires this, and its only expressions
> like:
>
> function<void> f;
>
> if(!f){ do_something; }
>
> that breaks, why not remove the macro and add a member operator! to
> function instead?

Fair enough. I haven't yet seen a compiler that fails to use the
pointer-to-member to bool conversion, so it should be safe to add operator!
and remove the macro completely...

> BTW I'm not entirely convinced that Borland is wrong to reject this -
> 5.3.1p8 talks of the operand being implicitly converted to bool, and refers
> to clause 4, which talks only of built in conversions to bool. Then again
> the section on the if statement talks only of implicit conversions as well
> - so I'm confused :-|
>
> - John Maddock
> http://ourworld.compuserve.com/homepages/john_maddock/

Implicit conversion means (4p3):
"An expression e can be implicitly converted to a type T if and only if the
declaration T t=e; is well-formed..."

So I think Borland is wrong to reject "if (!f) ...".

        Doug


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