C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Where await_transform = default?

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Tue, 24 Sep 2024 10:32:44 -0400
On Tue, Sep 24, 2024 at 2:12 AM Nikl Kelbon via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Just where is it? Example:
> You want to get handle from corouitne, writing awaiter:
>
> struct get_handle {
> ??? handle;
> await_ready();
> await_suspend(...);
> ??? await_resume { return hadle }
> }
>
> So, code must know type of handle where its called.

Can't you just use the type-erased form of `coroutine_handle`? Things
like this are *why* the coroutine handle can be type-erased from its
promise type: because most code which touches a handle doesn't really
need to interact with the promise.

Also, not all awaitables are coroutines, so it's generally not best to
presume that you can get a handle from something you can await on.

Received on 2024-09-24 14:32:57