need help to get member function const address

Calvin P changlon at
Thu Mar 19 13:46:39 UTC 2020

On Thursday, 19 March 2020 at 13:23:41 UTC, Adam D. Ruppe wrote:
> Check the error message there... you already have a function 
> pointer, no need to use the .funcptr metod.
> It is a bit weird though because it actually EXCLUDES the 
> hidden argument for `this`. I prefer doing wrapper functions 
> usually.

Thanks for the tips,   I can get it into enum but not be able to 
use it as const at compile time. I come up with this workaround:

static void* getCallee() pure @nogc nothrow {
		enum callee_ptr = &(__traits(getMember, App, name));
		return callee_ptr;

__gshared const AppHelper  APP_HELPER = {&getCallee,  ..};

More information about the Digitalmars-d-learn mailing list