A problem with generators

bearophile bearophileHUGS at lycos.com
Wed Mar 17 14:51:02 PDT 2010


Adam D. Ruppe:
> Even with your explanation, I still don't really get what yield does.

Try to read after the line:
"That's sugar for something like:"

You can see a generator that uses opApply that will be clear.

It's a way to spit out things out of a struct/class, it's a way to define a generator, that is something that spits out a new item every time you ask it to, with a foreach.

Bye,
bearophile



More information about the Digitalmars-d mailing list