45 typedef std::variant<std::monostate, Stdin, String, CheckedSourcePath, Hidden> Origin;
74 struct LinesIterator {
75 using difference_type = size_t;
76 using value_type = std::string_view;
77 using reference =
const std::string_view &;
78 using pointer =
const std::string_view *;
79 using iterator_category = std::input_iterator_tag;
81 LinesIterator(): pastEnd(
true) {}
82 explicit LinesIterator(std::string_view input): input(input), pastEnd(input.empty()) {
87 LinesIterator & operator++() {
91 LinesIterator operator++(
int) {
97 reference operator*()
const {
return curLine; }
98 pointer operator->()
const {
return &curLine; }
100 bool operator!=(
const LinesIterator & other)
const {
101 return !(*
this == other);
103 bool operator==(
const LinesIterator & other)
const {
104 return (pastEnd && other.pastEnd)
105 || (std::forward_as_tuple(input.size(), input.data())
106 == std::forward_as_tuple(other.input.size(), other.input.data()));
110 std::string_view input, curLine;
111 bool pastEnd =
false;
113 void bump(
bool atFirst);