提交 7b7fe01c 编写于 作者: Q Qiao Longfei

optimize code

上级 daba57f7
......@@ -101,16 +101,16 @@ class GzipReader : public Reader {
class PlainFileReader : public Reader {
public:
explicit PlainFileReader(const std::string& file_name)
: myfile_(file_name.c_str()) {}
: stream_(file_name.c_str()) {}
~PlainFileReader() {}
bool HasNext() override { return myfile_.peek() != EOF; }
bool HasNext() override { return stream_.peek() != EOF; }
void NextLine(std::string* line) override { std::getline(myfile_, *line); }
void NextLine(std::string* line) override { std::getline(stream_, *line); }
private:
std::ifstream myfile_;
std::ifstream stream_;
};
template <typename SingleFileReader>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册