On Sunday, 16 August 2015 at 23:05:42 UTC, Ali Çehreli wrote:
// Now the type of d is a template parameter
@nogc auto func(Func)(uint[] arr, Func d)
{
    return arr.map!(d);
}

Huh. I think func being a template is the key here. When the original code is put in a template, it works too (with 2.068):

----
void func()() @nogc
{
    import std.algorithm;
    uint[3] arr = [1,2,3];
    uint context = 2;
auto r = arr[].map!(delegate(value) { return value * context; });
}
void main()
{
    func();
}
----

Reply via email to