No, there is nothing especially natural about including the ending new line. / and * are symmetric on strings the iterator should be a / equivalent. I find that symmetry natural and beautiful.
/ Peter Bortas
Previous text:
2002-12-31 00:26: Subject: stdin->line_iterator
The natural way, if that's what you want to do, would be an iterator that emits lines *including* the final newline (or without it, for lines that have no terminator).
Your problem is that the line iterator drops the newlines, so that you don't see directly if any newlines were present to begin with. And to get that information back, you want it to return an empty lines at the end for the common case of files that are properly terminated.
I find that interface really strange and ugly. If a file contains ten lines, I'd expect a line_iterator to emit exactly ten lines, no more, no less.
/ Niels Möller ()