On Mon, 15 Jun 2015 15:10:20 +0000, jmh530 wrote: > So I suppose I have two questions: 1) am I screwing up the cast, or is > there no way to convert the MapResult to float[], 2) should I just not > bother with map (I wrote an alternate, longer, version that doesn't use > map but returns float[] properly).
MapResult is a wrapper around your original range that performs the mapping operation lazily. If you want eagerly evaluate and get back to an array use the std.array.array function: import std.array : array; auto y = x.map!(a => exp(a)).array; Or if you have already allocated an array of the appropriate size you can use std.algorithm.copy: import std.algorithm : copy; float[] y = new float[](appropriate_length); x.map!(a => exp(a)).copy(y);