hi, i am reading the book "The c++ standard library -- a tutorial and reference"{N.M.Josuttis}
in the beggining of the 6th chapter it says{in regard to container initialization}::
std::deque<int> c(
(std::istream_iterator<int>(std::cin)),
(std::istream_iterator<int>())
);
{the weird indentation is on purpose}
instead of::
std::deque<int> c(std::istream_iterator<int>(std::cin),
std::istream_iterator<int>());
because
In this case, c declares a function with a return type that is deque<int>. Its first
parameter is of type istream_iterator<int> with the name cin{???}, and its second
unnamed parameter is of type "function taking no arguments returning
istream_iterator<int>." This construct is valid syntactically as either a declaration
or an expression. So, according to language rules, it is treated as a declaration. The extra
parentheses force the initializer not to match the syntax of a declaration.
so the question is how can the compiler think that this is function....since std::istream_iterator<int>(std::cin)
is not a type.