10 Nov
2005
10 Nov
'05
6:56 p.m.
David Abrahams
But a close substiture might be to convert the variable to an integer, throw an exception if its not equal to 0 or 1
No!! If you convert a bool to an integer and get something other than 0 or 1 then there's a bug in the program (or in the compiler). An assertion is appropriate.
But that said, I wouldn't try to assert that any more than I'd try to validate that every pointer passed points at a valid object of the pointee type. -- Dave Abrahams Boost Consulting www.boost-consulting.com