need help to get member function const address

Boris Carvajal boris2.9 at gmail.com
Thu Mar 19 09:13:42 UTC 2020


On Thursday, 19 March 2020 at 04:30:32 UTC, Calvin P wrote:
> I use this code to get member function address on runtime:
>
> =========
> struct A {
>        this(){};
> }
> auto ctor = (&__traits(getMember, A.init,"__ctor")).funcptr;
> =========
>
>
> my question is, how to get it in compile time like static 
> function address

You asked the same question two days ago.
Check the reply.
https://forum.dlang.org/post/r4ohd3$2e94$1@digitalmars.com

You can assemble a delegate with an struct pointer or class 
reference and a function member pointer.


More information about the Digitalmars-d-learn mailing list