Iterators and Ranges: Comparing C++ to D to Rust
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Tue Jun 15 08:04:13 UTC 2021
On Tuesday, 15 June 2021 at 07:22:24 UTC, Araq wrote:
> We couldn't copy C++ or D's designs because they are
> fundamentally unsafe (iterator invalidation is complex and
> expensive).
Yes, but C++20 coroutines are completely different though.
My understanding is that the compiler analyse the coroutine
function and breaks it up into many functions so that the stack
is empty when it hits ```co_yield```, then the state is
synthesised into an object (I guess you could call it a closure).
Is this what Nim closure-iterators do?
More information about the Digitalmars-d
mailing list