On Saturday, 5 March 2016 at 13:15:46 UTC, Andrei Alexandrescu wrote:
On 03/04/2016 11:34 PM, Jonathan M Davis wrote:
This makes me wonder if something like iota would benefit from a similar
optimization.

Certainly. -- Andrei

I haven't done much with CTFE yet, but how would one get the type there right? iota accepts any Integral type, so the following seems a bit bulky..

```
template Iota(T)
{
    auto i(T end, T step = 1)()
    {
        return iota(end, step);
    }
    auto i(T begin, T end, T step = 1)()
    {
        return iota(begin, end, step);
    }
}

unittest
{
    import std.algorithm: equal;
static assert(Iota!int.i!(0, 10, 1).equal([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]));
}
```

Reply via email to