need help to get member function const address

Adam D. Ruppe destructionator at
Thu Mar 19 13:23:41 UTC 2020

On Thursday, 19 March 2020 at 04:30:32 UTC, Calvin P wrote:
> my question is, how to get it in compile time like static 
> function address:
> =========
> struct A {
>      void d(){};
>      static void fn(){};
> }
> enum FN = &A.fn;  // static method address is ok
> enum A1 = (&__traits(getMember, A,"d")).funcptr; // Error: no 
> property funcptr for type void function()

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.

More information about the Digitalmars-d-learn mailing list