C++ Logo


Advanced search

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

From: Nikl Kelbon <kelbonage_at_[hidden]>
Date: Sat, 3 Sep 2022 21:26:41 +0500
> Can you go into more details about the type erasure in question?
std::generator uses type erasure for Alloc by default (typename Alloc =
void), but generator even do not depends on allocator. It is useless
template argument and runtime / compilation overhead
> Are you suggesting that `generator<T>` not actually have a `T` stored
within it?
Value must be stored on coroutine frame as local variable or in awaiter
which is just a holder for value while generator suspended(if rvalue was
Dont know is co_yield {args...} supported, but it is possible to support
with yield_value hack(see implementation in first message)

Received on 2022-09-03 16:26:50