MCPcopy Create free account
hub / github.com/alibaba/async_simple / CountCharInFileAsyncImpl

Function CountCharInFileAsyncImpl

demo_example/ReadFiles.cpp:90–97  ·  view source on GitHub ↗

The *Impl is not the key point for this example, code readers could ignore this.

Source from the content-addressed store, hash-verified

88// The *Impl is not the key point for this example, code readers
89// could ignore this.
90Future<uint64_t> CountCharInFileAsyncImpl(const FileName &File, char c) {
91 uint64_t Ret = 0;
92 std::ifstream infile(File);
93 std::string line;
94 while (std::getline(infile, line))
95 Ret += std::count(line.begin(), line.end(), c);
96 return makeReadyFuture(std::move(Ret));
97}
98
99Future<uint64_t> CountCharInFilesAsync(const std::vector<FileName> &Files,
100 char c) {

Callers 1

CountCharInFilesAsyncFunction · 0.85

Calls 3

makeReadyFutureFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected