Iterators and Ranges: Comparing C++ to D to Rust

Paulo Pinto pjmlp at progtools.org
Tue Jun 15 08:36:16 UTC 2021


On Tuesday, 15 June 2021 at 08:04:13 UTC, Ola Fosheim Grøstad 
wrote:
> 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).
>

It is a bit more elaborated than that.

I suggest a carefull reading of all these posts to get a good 
overview of all use cases.

https://devblogs.microsoft.com/oldnewthing/20210504-01/?p=105178




More information about the Digitalmars-d mailing list