
30 Mar
2009
30 Mar
'09
11:08 p.m.
Based on the suggestions from Steven Watanabe and Robert Stewart I've uploaded safebool.hpp into the Vault. It can be deployed as struct Foo { ... operator safebool<Foo>::type() const { return safebool<Foo>(condition); } }; or operator safebool<Foo>::type() const { return safebool<Foo>::make(c); } or operator safebool<Foo>::type() const { return make_safebool<Foo>(c); } I still like the first one but the other two seemed strong contenders and I realize they might be marginally faster (in theory anyway). Documented the need, the usage and the solution. Best, V.