* James Kanze, on 10.08.2010 09:56:
It's an idiom that I've never seen in well written C or C++.
Good idea to start using it with MSVC. ;-) (Since it spews out silly-warnings,
if all things about /performance/, on implicit conversions to bool (you've
probably worked mostly with more reasonable compilers, I guess)).
Which means...? (I don't know python, so I don't see any
relevance with what we're discussing.)
It extracts each line from a stream.
The inside is ugly, an exception is thrown on end of stream and caught by the
loop construct. But the details don't matter, it could have worked in some
different way. All that an implicit conversion to bool is about is convenience
of notation, and mostly for the case of iteration, and nothing can be more
convenient than built-in language support for iterating over a collection.
Happily C++0x will have such a construct but it doesn't help with the getting
rid of the conversions...
Cheers,
- Alf