In the below code, we call in.get(c)
repeatedly and it returns an isteam&
each time. How does an instance of isteam&
evaluate to false in the while statement?
I checked that in.get
isn't returning a null reference so I'm not sure how else it could evaluate to false.
istream &to_std_out(istream &in) {
char c;
while (in.get(c)) {
cout << c;
}
in.clear();
return in;
}
int main() {
istringstream str("A sailor went to see, see, see.");
to_std_out(str);
}