<p>I have a loop that reads each line in a file using <code>getline()</code>:</p>

<pre><code>istream is;
string line;
while (!getline(is, line).eof())
{
    // ...
}
</code></pre>

<p>I noticed that calling <code>getline()</code> like this also seems to work:</p>

<pre><code>while (getline(is, line))
</code></pre>

<p>What's going on here? <code>getline()</code> returns a stream reference. Is it being converted to a pointer somehow? Is this actually a good practice or should I stick to the first form?</p>

Updated:
I had mistakenly pointed to the
basic_istream documentation
for the operator bool() method on the basic_istream::sentry class, but as has been pointed out this is not actually what's happening.  I've voted up Charles and Luc's correct answers.  It's actually operator void*() that's getting called.  More on this
in the C++ FAQ
.