MCPcopy Create free account
hub / github.com/David-Haim/concurrencpp / read_lines

Function read_lines

example/13_generator/source/main.cpp:7–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "concurrencpp/concurrencpp.h"
6
7concurrencpp::generator<std::string_view> read_lines(std::string_view text) {
8 std::string_view::size_type pos = 0;
9 std::string_view::size_type prev = 0;
10
11 while ((pos = text.find('\n', prev)) != std::string::npos) {
12 co_yield text.substr(prev, pos - prev);
13 prev = pos + 1;
14 }
15
16 co_yield text.substr(prev);
17}
18
19concurrencpp::result<void> read_file_lines(const std::filesystem::path& path,
20 std::shared_ptr<concurrencpp::thread_pool_executor> background_executor,

Callers 1

read_file_linesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected