On Sun, Jul 22, 2012 at 1:46 PM, monarch_dodra <monarchdo...@gmail.com> wrote:

> ...But I think it has one major drawback: You can't specify the type of the
> array you want. For example, if you have a range of ints, and you'd want to
> duplicate it into a range of doubles, well array doesn't allow that.

>
> The above example is simple, but it could allow more powerful usage such as:
> auto integralThirds = iota(1,20).map(a => a/3).array!int;

What about

import std.conv: to;
auto integralThirds = iota(1,20).map(a => to!int(a/3)).array;

?

It even allows converting to strings, which is something I do very often.

Philippe

Reply via email to