It is a declaration of a variable (an object) with string type.
The basic rule is that if something can be interpreted as a
declaration (rather than as an expression), then it is. So if
you write something like:
std::istream_iterator<char>(file)
it is a declaration (of a variable named file, with type
std::istream_iterator< char >), unless the context where it
appears doesn't allow declarations.
The case of:
std::istream_iterator<char>()
is more complicated, since there is nothing that could be being
declared. But there are a few contexts, such as the declaration
of a function parameter, where you do not need to name what is
being declared. In such cases, this is a declaration of a
function (and as a function parameter, the declaration of a
function is "reinterpreted" as the declaration of a pointer to a
function.
In your code above, but without the braces, if you interpret
these expressions as declarations, you end up with a legal
function declaration. Since they can be interpreted as
declarations, the standard says that they should be, and you
have a legal function declaration. If you put even one in
parentheses, however... a declaration can never appear in
parentheses, so it cannot be a declaration, and must be an
expression (an "explicit type conversion (functional notation)",
according to the standard---the explicit creation of a
temporary, in common parlance). And if even one of them is an
expression, then the complete statement cannot be a function
declaration, which means that the second can't be a declaration
either. And if they're expressions, then the statement must be
the definition of a variable, with direct initialization and two
initializers (which means that the variable will be initialized
by calling the constructor found by overload resolution for the
two expressions).
They shouldn't compile anywhere.
(Note too that you'll find a lot of things on the Web. There's
no requirement that anything be correct for it to appear in a
web page.)
--
James Kanze (GABI Software) email:
[email protected]
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34