C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Do not accept std::generator, please.

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sat, 3 Sep 2022 11:20:25 -0400
On Sat, Sep 3, 2022 at 4:49 AM Nikl Kelbon via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> 2. Overhead for ueslss default type erasure(default behavior) and stack in generator (used only for element_of, which is basically for(auto&& v : gen) co_yield v;
> Its just uselss
> You pay for what you dont use.

Can you go into more details about the type erasure in question?

> 4. interface that is very obscure to the user and requires knowledge of implementation to write efficient code
> No one will write generator<const T&> foo(); without knowing why it is needed and why it is better for perfmornace

Are you suggesting that `generator<T>` not actually have a `T` stored
within it? That it would always assume that the coroutine function
provides storage for the `T` and thus always references the
`co_yield`ed value?

Can you go into some details here about the problem in question?

Received on 2022-09-03 15:21:00