Boost logo

Boost :

Subject: Re: [boost] safe bool not safe enough ?
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2013-07-28 07:13:15


2013/7/28 Ahmed Charles <acharles_at_[hidden]>

>
> > So
> > bool b = t; // I wish it worked with Testable::explicit operator bool,
> but
> > doesn't.
>
> Sorry for bringing up such an old thread, but what's wrong with writing:
>
> bool b(t);
>
> Which does the same thing?

Obviously needing to fix old code, that uses the former syntax ;-)

And by the way, the use case I'll miss the most is:

bool f()
{
  shared_ptr<T> p = something();
  some_other_things();
  return p;
}

The last line will need to be changed somethink like:
  return !!p;

It's no big deal, but I'll personally miss the old syntax ;-)

Regards,
Kris


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