
Looks OK to me but anyone 'deprecating' this before I add it to the guidelines?
Are we sure that all compilers can evaluate this as compile time - otherwise while debugging users might find it a pest?
While this is a a workaround that disables the warning, I personally find it almost unreadable, and wouldn't want to encourage it's usage. In my mind when I see a ! I think "not", and have to always apply extra brain power to realise there are 2, and what it means.
Me too. I accept that this idiom has it's uses though - for example where the type being tested has an operator !() but no direct conversion to bool - although the "safe bool conversion idiom" used in Boost and elsewhere is IMO superior to this. What's wrong with using either x != 0, or x == 0, depending on which result you want? It's pretty explicit , and exactly mirrors what the compiler has to do internally to convert x to a bool in the first place? John .