Boost logo

Boost :

Subject: Re: [boost] [safebool] Can we generalize it and put it into utilities?
From: Vladimir Batov (vladimir.batov_at_[hidden])
Date: 2009-03-31 23:06:16


> Eugene Wee <crystalrecursion <at> gmail.com> writes:
> > I glanced over "explicit conversion operators" in C++0x. It did not struck
> > me as relevant to safe_bool. Care to elaborate?
>
> It is relevant since you can say, define an explicit conversion function to
> convert to bool, and yet avoid the very problems with say, also allowing
> implicit conversion to int, that the safe bool idiom is used to avoid. In
> other words, it is a language feature directly designed to replace the safe
> bool idiom, and more.

Ah, my bad, I was damn looking at something completely else. :-( Now I found the
relevant section (12.3.2. Conversion functions) and see that adding 'explicit'
seem to fix all the problems we are now trying to solve with safe_bool. Thanks
for setting me straight. Problem solved then... well, it is being taken care of,
anyway. Sorry for all the noise.

Thanks,
V.


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