number ranges

Ali Çehreli acehreli at yahoo.com
Tue Jan 18 20:50:06 UTC 2022


On 1/18/22 12:43, forkit wrote:

 > wrapper function...
 >
 >
 > auto range(T:T)(T a, T b)
 > {
 >      import std.range : iota;
 >      return iota(a, (b+1));
 > }

Needs a little more work to be correct. The following produces and empty 
range. ;)

   range(uint.min, uint.max)

Also, is it important for the result to be the same as T? For example, 
even if T is ubyte, because b+1 is 'int', the range will produce ints.

Ali



More information about the Digitalmars-d-learn mailing list