Iterators_2 is a project mainly written in D, based on the BSD-3-Clause license.
Advanced real iterators/generators for D programing language
corod is a framework for generators.
Using corods is simple, as they can be chained into the pipeline, and easly iterated:
void main(string[] args) { auto rr = new Randoms!(uint)(123); auto ru = new RandomsUniform!(float)(rr);
foreach (x; new Foreach!(float, ru, 1000)()) {
writefln("%g", x);
}
}
Implemeneing corods is also simple:
final class SimpleSomething : FiberGenerator!(int) { public: /// this(int What, int Times) { What = What; Times = Times; }
int What, Times;
protected: override void iter() { for (int i = 0; i < Times; i++) { yield(What); } } }
Generators in corod are implemented using Fiber's, and are like cooperative Threads.
Framework contains few usefull classes: