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
On Tuesday, 30 July 2019 at 10:06:21 UTC, Newbie2019 wrote:
template isDelegateMember(S, string name, D) if(is(S == struct)
&& __traits(hasMember, S, name) && is( D == delegate ) ) {
alias Fn= typeof( __traits(getMember, S.init, name) );
static assert( isFunction!Fn );
I need to check on struct members is match a delegate type. for
example;
alias Type = scope void delegate(int) @nogc ;
struct S {
void onMatch1(int) scope @nogc {
}
void onNotMatch2(int) scope {
}
void onNotMatch2(int, int) scope @nogc {
}
Type not_match3;
}