Dear cpp-cg,
I've placed a new comment about using a C++23 technique related to an old issue regarding coroutine lambdas.
However, since that issue is closed, I'm not sure if anyone actually noticed my comment, hence posting a link to that comment in this new issue:
#1756 (comment)
the gist is the following:
// Safe (C++23): The closure object is copied into the coroutine frame.
awaitable_task_type<int> compute_safe_cpp23() {
int multiplier = 2;
auto future = [multiplier](this auto /* keeps the captures alive */) -> awaitable_task_type<int> {
co_await some_task_library::sleep(std::chrono::seconds(1));
co_return multiplier * 21;
}();
co_return co_await std::move(future);
}
Dear cpp-cg,
I've placed a new comment about using a C++23 technique related to an old issue regarding coroutine lambdas.
However, since that issue is closed, I'm not sure if anyone actually noticed my comment, hence posting a link to that comment in this new issue:
#1756 (comment)
the gist is the following: