Jason House wrote:
> Eric Poggel Wrote:
>> I don't have D2 installed, but the above fails to compile in d1 
>> (non-constant expression __dgliteral1).  
> 
> 
> Here's the code I use in D2:
> 
> R delegate(T) toDelegate(R, T...)(R function(T) f){
>    return delegate R(T t){return f(t);};
> }

What happens when you do this, though?

void foo(ref int v) { v = 42; }

void main()
{
    auto dg = toDelegate(&foo);
    int v; dg(v);
    writefln("%s", v);
}

Reply via email to