Can't get UDAs of constants (enums) !

Johan Engelen via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 24 11:07:40 PDT 2017


On Saturday, 24 June 2017 at 17:42:48 UTC, Johan Engelen wrote:
>
> Does anybody know a workaround?

I got something with mixins now that seems to work.
```
void foo(string modname)() {
     mixin("static import mod = " ~ modname ~ ";");
     foreach(name; __traits(allMembers, mod)) {
         pragma(msg, name);
         pragma(msg, mixin("__traits(getAttributes, " ~ modname ~ 
"." ~ name ~")"));
     }
}
```


More information about the Digitalmars-d mailing list