MCPcopy Create free account
hub / github.com/boostorg/leaf / launch_tasks

Function launch_tasks

test/capture_result_async_test.cpp:46–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44
45template <class F>
46std::vector<fut_info> launch_tasks( int task_count, F f )
47{
48 BOOST_LEAF_ASSERT(task_count>0);
49 std::vector<fut_info> fut;
50 std::generate_n( std::back_inserter(fut), task_count,
51 [=]
52 {
53 int const a = rand();
54 int const b = rand();
55 int const res = (rand()%10) - 5;
56 return fut_info { a, b, res, std::async( std::launch::async,
57 [=]
58 {
59 return leaf::try_capture_all(
60 [&]() -> leaf::result<int>
61 {
62 return f(a, b, res);
63 } );
64 } ) };
65 } );
66 return fut;
67}
68
69int main()
70{

Callers 1

mainFunction · 0.70

Calls 2

try_capture_allFunction · 0.85
fFunction · 0.70

Tested by

no test coverage detected