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

optimize code

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