save() feature for iota

Salih Dincer salihdb at hotmail.com
Thu Nov 3 06:26:22 UTC 2022


Hi All,

Isn't there a save feature for `iota()`?

```d
import std.stdio;
import std.range;

void main()
{
   foreach(num; iota!char('a', 'f').chunks(3)/*
               "onetwosixfour".chunks(3)//*/
   ) {
		//auto n = num.save();
		num.writeln(": ", num.walkLength);
   }
} /* Prints:
: 3
: 2
*/
```
So is there a way to find out the length of an `iota()` range 
without consuming it?

SDB at 79


More information about the Digitalmars-d-learn mailing list