August 2009 Archives

2009-08-22

The Safe Bool Idiom

Operator overloading is considered a major C++ feature. But as so often with C++ this feature sometimes clashes with other language properties.

Roker pointed me to an article about the safe bool idiom where the author elaborates on why a simple operator bool is not satisfying if you want to be able to use an object within a bool context. Have fun...


Posted by Alexander Bernauer | Permanent link | File under: C++