We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b20def commit f1977d0Copy full SHA for f1977d0
include/rusty_iterators/file_iterator.hpp
@@ -28,8 +28,10 @@ class FileIterator<FIterType::Buffered>
28
: public IterInterface<std::string, FileIterator<FIterType::Buffered>>
29
{
30
public:
31
- explicit FileIterator(const std::string& filePath) : is(filePath)
+ explicit FileIterator(const std::string& filePath)
32
33
+ std::ifstream is{filePath};
34
+
35
if (!is.is_open())
36
37
throw std::runtime_error{"Could not open the file."};
@@ -62,7 +64,6 @@ class FileIterator<FIterType::Buffered>
62
64
63
65
private:
66
size_t ptr = 0;
- std::ifstream is;
67
std::vector<std::string> fileLines{};
68
};
69
0 commit comments