MCPcopy Create free account
hub / github.com/boostorg/asio / read_input

Function read_input

example/cpp14/operations/callback_wrapper.cpp:20–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19template <typename Callback>
20void read_input(const std::string& prompt, Callback cb)
21{
22 std::thread(
23 [prompt, cb = std::move(cb)]() mutable
24 {
25 std::cout << prompt << ": ";
26 std::cout.flush();
27 std::string line;
28 std::getline(std::cin, line);
29 std::move(cb)(std::move(line));
30 }).detach();
31}
32
33//------------------------------------------------------------------------------
34

Callers 1

async_read_inputFunction · 0.70

Calls 2

detachMethod · 0.80
flushMethod · 0.80

Tested by

no test coverage detected