28 Feb
2014
28 Feb
'14
8:24 p.m.
On 28 February 2014 13:11, Frank Mori Hess
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@eviloverlord.com (847) 691-1404