In this answer I talk about using a std::ifstream object\'s conversion to bool to test whether the stream is still in a good state. I looked in th
std::ifstream
bool
This is an instance of the "safe bool" problem.
Here is a good article: http://www.artima.com/cppsource/safebool.html .
C++0x helps the situation with explicit conversion functions, as well as the change that Kristo mentions. See also Is the safe-bool idiom obsolete in C++11? .
explicit