How can I read from an std::istream
using operator>>
?
I tried the following:
void foo(const std::istream& in) {
std::string tmp;
while(in >> tmp) {
std::cout << tmp;
}
}
But it gives an error:
error: no match for 'operator>>' in 'in >> tmp'