Boost logo

Boost :

Subject: Re: [boost] [signals2] Test failure in C++11 (trivial fix for incorrect usage of boost::optional)
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2014-02-26 19:47:47

On 26/02/2014 08:17 p.m., Frank Mori Hess wrote:
> On Tue, Feb 25, 2014 at 10:58 PM, Ben Pope <benpope81_at_[hidden]> wrote:
>> On Wednesday, December 11, 2013 03:26 PM, Ben Pope wrote:
>>> The trivial fix is to change the if statements at:
>>> .../libs/signals2/test/signal_test.cpp:32:16:
>>> .../libs/signals2/test/track_test.cpp:36:14:
>>> to if(!max) rather than if(max == false).
> Thanks for putting in the ticket, I never noticed the original mailing
> list post back in December. I read the explanation of the problem
> referred to in the original December post, however it seems to me the
> bug is in optional's safe-bool implementation under c++11. That is,
> the expression "max==false" should implicitly convert the optional
> "max" to a boolean and compile.

That's incorrect, `false` is not a disengaged `optional`. If you want to
write your comparisons that way you should write `max==boost::none` (or
`max==std::nullopt` in the standard proposal).


Agustín K-ballo Bergé.-

Boost list run by bdawes at, gregod at, cpdaniel at, john at