File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -44,24 +44,25 @@ class FileIterator<FIterType::Buffered>
4444 fileLines.push_back (std::move (nextLine));
4545 }
4646 is.close ();
47+ ptr = fileLines.begin ();
4748 };
4849
4950 auto next () -> std::optional<std::string>
5051 {
51- [[unlikely]] if (ptr == fileLines.size ())
52+ [[unlikely]] if (ptr == fileLines.end ())
5253 {
5354 return std::nullopt ;
5455 }
55- auto line = fileLines. at ( ptr) ;
56+ auto line = * ptr;
5657 ptr += 1 ;
5758 return std::move (line);
5859 }
5960
60- [[nodiscard]] auto sizeHint () const -> std::optional<size_t> { return fileLines.size () ; }
61+ [[nodiscard]] auto sizeHint () const -> std::optional<size_t> { return fileLines.end () - ptr ; }
6162
6263 private:
63- size_t ptr = 0 ;
6464 std::vector<std::string> fileLines{};
65+ std::vector<std::string>::iterator ptr;
6566};
6667
6768template <>
You can’t perform that action at this time.
0 commit comments