Subject: Re: [std-proposals] Coroutine local destructor
From: Arthur O'Dwyer (arthur.j.odwyer_at_[hidden])
Date: 2020-05-22 13:16:20
On Fri, May 22, 2020 at 1:52 PM Marcin Jaczewski <
> This is what I try to achieve:
> Idea is have stackfull corutine with local memory allocation. Idea is
> that you can have multiple corutines start in one function and each
> have its own buffer.
> There is no easy way to have this `LocalStack&` for `delete`.
> Right now only way I see is add special code to `task<>` destructor
> and pass information other way to correctly release memory.
It does surprise me that both
`PromiseType::operator delete` were specified to take zero arguments,
instead of taking the same "parameter preview" arguments as `operator
new`. That seems like a mistake by WG21. Allocation and deallocation are
flip sides of the same coin; of course they require the same parameters to
accomplish their job.
Mathias Stearn (cc'ed) authoritatively comments here
<https://hackmd.io/@redbeard0531/S1H_loeA7?type=view> that parameter
preview isn't supported in these cases, but I don't know why not.
If your goal is just to permit the deallocation function to access
`LocalStack& ls`, could you store a pointer to `ls` inside the `Promise`
itself, and then give it a C++20 "destroying destructor"?
STD-PROPOSALS list run by firstname.lastname@example.org
Standard Proposals Archives on Google Groups