On Tuesday, 24 December 2013 at 10:44:54 UTC, bearophile wrote:
Francesco Cattoglio:

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

Nice point: the issue here is that every iota defines its own return type. I will see if there's some way around this on the library side. The "user side" workaround is simple:

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

Reply via email to