Talk:More C++ Idioms/Safe bool

C++11 example
Shouldn't it be `if(bool(a))` instead of `if(a)`? Because it's an explicit operator, has to be textually called, right? Enamex (discuss • contribs) 16:32, 20 May 2015 (UTC)

Code alternative?
Is there any reason why the two safe_bool equality comparison operators are written the way they are, as opposed to a shorter and (IMHO) more readable form:

template    bool operator==(const safe_bool & lhs, bool b) { return bool(lhs) == b;  } template    bool operator==(bool b, const safe_bool & rhs) { return b == bool(rhs); }

As far as I know, both the if statement and the explicit bool cast will have the same effect in this scenario. Also one of the operators could be implemented using the other one, but it would probably unnecessarily obfuscate the code. What do you think? --Holecekja (discuss • contribs) 18:51, 2 January 2012 (UTC)

Copyright
It looks like the code is copied pretty much verbatim from the linked article, which doesn't appear to be Creative Commons. I doubt this is in serious practical danger, but it goes against the spirit of Wikibooks. I think this should be rewritten. --Fishpi (discuss • contribs) 00:07, 8 March 2014 (UTC)