Boost logo

Boost :

Subject: Re: [boost] [signals2] Test failure in C++11 (trivial fix for incorrect usage of boost::optional)
From: Nevin Liber (nevin_at_[hidden])
Date: 2014-02-28 15:24:07

On 28 February 2014 13:11, Frank Mori Hess <fmh6jj_at_[hidden]> wrote:

> 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.

The optional<T> vs. T comparisons are wanted for containers, as people
don't want to pay the cost of constructing an optional just to, say, do a
find in a C++1y map.

We could always specialize optional<bool>, because that worked oh-so-well
for vector...

 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

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