how to get the struct member as delegate type ?

Newbie2019 newbie2019 at gmail.com
Tue Jul 30 10:19:22 UTC 2019


On Tuesday, 30 July 2019 at 10:08:55 UTC, Newbie2019 wrote:
> foreach(int name_index, name; __traits(allMembers, S) ) static 
> if( isDelegateMember!(S, name, Type) ) {
>     enum Rules = getUDAs!( __traits(getMember, S, name) , Rule);
>      // handle the member is match this rules.
> }


And one more question, how to get the Function address or 
delegate address of a struct member
  on compile time ?

struct S {
     void onMatch(){}
}


__gshared auto onMatch = (&(S.init)).funcptr ;  // this not work




More information about the Digitalmars-d-learn mailing list