hasAttrib

template hasAttrib () {
enum hasAttrib;
}

Examples

1 enum clot;
2 size_t zlot(string s){ return s.length; }
3 
4 void fnc1() @clot {}
5 void fnc2() @clot @zlot("ok") {}
6 void fnc3() @zlot("abc") {}
7 
8 static assert(  hasAttrib!(clot,fnc1) );
9 static assert(  hasAttrib!(clot,fnc2) );
10 static assert(  hasAttrib!(2,fnc2) );
11 static assert( !hasAttrib!(clot,fnc3) );
12 static assert(  hasAttrib!(3,fnc3) );

Meta