no matching function for call to 'getline'
- by WTP
I have a class called parser:
class parser {
const std::istream& stream;
public:
parser(const std::istream& stream_) : stream(stream_) {}
~parser() {}
void parse();
};
In parser::parse I want to loop over each line, so I use std::getline:
std::getline(stream, line)
The compiler gives me this error, however:
src/parser.cc:10:7: error: no matching function for call to 'getline'
std::getline(stream, line);
^~~~~~~~~~~~
But the first argument to std::getline is of type std::istream&, right? What could I be doing wrong?