Boost logo

Boost :

Subject: Re: [boost] [signals2] Test failure in C++11 (trivial fix for incorrect usage of boost::optional)
From: Frank Mori Hess (fmh6jj_at_[hidden])
Date: 2014-02-27 18:15:11


On Thu, Feb 27, 2014 at 8:14 AM, Peter Dimov <lists_at_[hidden]> wrote:
> The C++11 "explicit operator bool" feature is stricter than the safe bool
> idiom. !max is fine, because !x is considered a boolean context for x; max
> == false is not, because x == y is not a boolean context for x or y.

Yes, but boost::optional doesn't use explicit operator bool, even when
compiling under c++11 as far as I know. It is the behavior of
optional's safe bool idiom implementation which has changed due to
language changes in c++11. Even if optional is changed to use
explicit operator bool, does that exclude the possibility of adding
free operator== and operator != methods which take one argument as an
optional and one argument as a bool? Would such overloads actually
introduce any dangerous behavior?

-- 
Frank

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