Comeau online hates it.
std::vector<line_t> v(
std::istream_iterator<line_t>(std::cin),
std::istream_iterator<line_t>());
Comeau is mistaking this statement for a function declaration.
I believe Comeau is at fault, but I would love to be
corrected.
It's an interesting question. It looks like a function
declaration. But as Comeau says, the argument in a function
declaration cannot take a qualified name, so it can't be a
(legal) function declaration. Whether this is enough to
disqualify it as a function declaration or not, however, I don't
know. (If instead of std::cin, he had written just cin, or used
the name of a local variable, there would be no doubt that it
was a function declaration.)
You can
work around this issue with:
std::istream_iterator<line_t> in(std::cin), end;
std::vector<line_t> v(in, end);
The more or less standard solution is to put an extra pair of
parentheses around the arguments, e.g.:
std::vector<line_t> v(
(std::istream_iterator<line_t>(std::cin)),
(std::istream_iterator<line_t>()));
(Putting them around either of the arguments is sufficient, but
there's no harm in being consistent.)
Thanks, guys. I didn't realize I'd hit the "most vexing parse". I'm
but for some reason, it blew right by me. Go figure.