0

Is there an existing facility to iterate over lines of an std::string_view such that the lines returned are also std::string_view, and thus no copies are made from the source.

In sudo code:

std::string_view GetNextLine(StringViewStream svs) {
    return GetLine(svs);
}
Dess
  • 2,064
  • 19
  • 35
  • 2
    [`std::views::split('\n')`](https://en.cppreference.com/w/cpp/ranges/split_view)? – 康桓瑋 Jan 22 '23 at 17:50
  • 1
    If you can't use C++20 then I have this for you (I needed a function like that myself a while back so I wrote it) : https://onlinegdb.com/nH-9MwOGs – Pepijn Kramer Jan 22 '23 at 18:01
  • I was hoping I didn't have to do the parsing myself, but it seems it's not too difficult. Will do it manually. – Dess Jan 22 '23 at 18:21

0 Answers0