Not sure if this is the de facto answer, but I found this one from back in the day.

R delegate(T) toDg(R, T...)(R function(T) fp) {
   struct dg {
       R opCall(T t) {
           return (cast(R function(T)) this) (t);
       }
   }
   R delegate(T) t;
   t.ptr = fp;
   t.funcptr = &dg.opCall;
   return t;
}

-Craig

Reply via email to