The value to yield.
1 import std.range; 2 3 InputRange!int myIota = iota(10).inputRangeObject; 4 5 myIota.popFront(); 6 myIota.popFront(); 7 assert(myIota.moveFront == 2); 8 assert(myIota.front == 2); 9 myIota.popFront(); 10 assert(myIota.front == 3); 11 12 //can be assigned to std.range.interfaces.InputRange directly 13 myIota = new Generator!int( 14 { 15 foreach (i; 0 .. 10) yield(i); 16 }); 17 18 myIota.popFront(); 19 myIota.popFront(); 20 assert(myIota.moveFront == 2); 21 assert(myIota.front == 2); 22 myIota.popFront(); 23 assert(myIota.front == 3); 24 25 size_t[2] counter = [0, 0]; 26 foreach (i, unused; myIota) counter[] += [1, i]; 27 28 assert(myIota.empty); 29 assert(counter == [7, 21]);
Yields a value of type T to the caller of the currently executing generator.