I have the following two lines of code:
vector<int> temp(istream_iterator<int>(cin),
istream_iterator<int>());
copy(temp.begin(), temp.end(), ostream_iterator<int>(cout, " "));
Which is supposed to read from stdin into a vector containing int and prints it to stdout.
But I get the following error:
request for member ‘begin’ in ‘temp’, which is of non-class type ‘std::vector<int>(std::istream_iterator<int>, std::istream_iterator<int> (*)())’
copy(temp.begin(), temp.end(), ostream_iterator<int>(cout, " "));
Which I suspect I get is because the vector initialization looks suspiciously like a function prototype. How do I fix this?