Impressed

Simen Kjaeraas simen.kjaras at gmail.com
Fri Jul 27 01:34:11 PDT 2012


On Fri, 27 Jul 2012 09:42:37 +0200, Nick Sabalausky  
<SeeWebsiteToContactMe at semitwist.com> wrote:

> On Fri, 27 Jul 2012 08:31:36 +0200
> Jacob Carlborg <doob at me.com> wrote:
>>
>> Note that iterators in .NET and C++ are a bit different. .NET has
>> language support with the "yield" keyword.
>>
>
> I wonder how that works under the hood. Like, if it's somewhat similar
> to opApply. Or maybe more like an Asm-style "messin' with the call
> stack's return addresses". I would hope it wouldn't involve fiber
> context switches, unless they're somehow much faster than D fiber
> context switches (which would seem weird, being in a VM).

The compiler generates a state-machine for you.

http://blogs.msdn.com/b/wesdyer/archive/2007/03/23/all-about-iterators.aspx

-- 
Simen


More information about the Digitalmars-d mailing list