39 typedef std::variant<std::monostate, Stdin, String, SourcePath> Origin;
76 struct LinesIterator {
77 using difference_type =
size_t;
78 using value_type = std::string_view;
79 using reference =
const std::string_view &;
80 using pointer =
const std::string_view *;
81 using iterator_category = std::input_iterator_tag;
83 LinesIterator(): pastEnd(
true) {}
84 explicit LinesIterator(std::string_view input): input(input), pastEnd(input.empty()) {
89 LinesIterator & operator++() {
93 LinesIterator operator++(
int) {
99 reference operator*()
const {
return curLine; }
100 pointer operator->()
const {
return &curLine; }
102 bool operator!=(
const LinesIterator & other)
const {
103 return !(*
this == other);
105 bool operator==(
const LinesIterator & other)
const {
106 return (pastEnd && other.pastEnd)
107 || (std::forward_as_tuple(input.size(), input.data())
108 == std::forward_as_tuple(other.input.size(), other.input.data()));
112 std::string_view input, curLine;
113 bool pastEnd =
false;
115 void bump(
bool atFirst);