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-28 14:11:37

On Fri, Feb 28, 2014 at 1:30 PM, Peter Dimov <lists_at_[hidden]> wrote:
> Frank Mori Hess wrote:
>> Ok, but when you are going over some code and see "x==false", and decide
>> to refactor it to "!x" for all the reasons you've given, you've just broken
>> the code. Because they mean completely different things
> for optional<bool>.
> Well that's correct. But then again, if I decide to refactor 'x == true'
> into 'x', this can also break the code if x is some esoteric type such as
> 'int'. :-)

Allright, I'll just make one more quibble then stop my ranting.
Someone writing "x==true" where x is an int to test if x is exactly 1
is just bad code in the first place. However, writing "x==true" where
x is an optional<bool> is apparently (at least to some as a recent
post indicates) the by-design way a value inside an optional<bool>
should be compared.


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