Hello Sergey,

Is there a way to declare and statically initialize some sort of
pointer to method, and later call it for an actual object instance?


dosn't work but might point you in the right direction:

template Pn2Fn(R, char[] method)
{
ReturnTypeOf!(mixin("R." ~ method)) Pn2Fn(R r, ArgsOf!(mixin("R." ~ method)) args)
    {
         return mixin("r."~method~"(args);");
    }

}


// use

auto it = &Pn2Fn!(Type, "method");

//call as

it(type);


Reply via email to