std.range.iota enhancement: supporting more types (AKA issue 10762)

bearophile bearophileHUGS at lycos.com
Tue Dec 24 02:44:53 PST 2013


Francesco Cattoglio:

> I agree. After relaxing the range, we can prefer a specialized 
> version over the iota(begin, end, 1) version. The latter should 
> be used as a backup instead for cases where ++ is not 
> implemented.

One possible disadvantage is when you want an array of various 
iota (all of the same indexed type, like int) (currently this 
doesn't compile), this was a potential use case for me:

void main() {
     import std.range: iota;
     auto intervals = [iota(10), iota(2, 7), iota(2, 15, 2)];
}

Bye,
bearophile


More information about the Digitalmars-d mailing list