Lemonfiend:

If I instead do ie. map!`cast(int)a` it works fine.
What am I missing?

Generally don't use casts, unless you know what you are doing (and often you don't).

The code you were trying to write:

struct Foo(T) {
    T t;
}

void main() {
    import std.stdio, std.algorithm, std.array;

    float[] vals = [1.1, 2.1, 3.1, 4.1];
    auto arr = vals.map!(Foo!float).array;
    arr.writeln;
}

Bye,
bearophile

Reply via email to