3 ms·
Alternatively, you can pass the things you would have captured instead as arguments to the lambda (by value!) and they are valid for the duration of the corouti
by grogers 4y ago
Alternatively, you can pass the things you would have captured instead as arguments to the lambda (by value!) and they are valid for the duration of the coroutine. So you can do a lambda returning a coroutine lambda like
task<Foo> t = [foo]() {
return [](auto f) -> task<Foo> {
co_await something();
co_return f;
}(foo);
}();