no matching function for call to 'getline'
Posted
by
WTP
on Stack Overflow
See other posts from Stack Overflow
or by WTP
Published on 2011-11-15T17:44:47Z
Indexed on
2011/11/15
17:50 UTC
Read the original article
Hit count: 389
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?
© Stack Overflow or respective owner