toDelegate() for D1

%u e at ee.com
Wed Jan 12 09:21:06 PST 2011


== Quote from Simen kjaeraas (simen.kjaras at gmail.com)'s article
> %u <e at ee.com> wrote:
> > I only need something to make a void deleg() from a void func().
> This works for me:
> ReturnType!( F ) delegate( ParameterTypeTuple!( F ) ) toDelegate( F )( F
> fn ) {
>      return ( ParameterTypeTuple!( F ) args ){ return fn( args ); };
> }

I see what you did there(took me a few blinks and spec lookups): function literals
default to delegates :)
Thanks!!


More information about the Digitalmars-d-learn mailing list