Function parameters UDAs

Adam D. Ruppe destructionator at gmail.com
Tue Jun 11 02:24:49 UTC 2019


On Tuesday, 11 June 2019 at 02:04:13 UTC, Machine Code wrote:
> I also, quite disappointed how UDAs doesn't work with enums. I 
> end up using struct + enum to simulate that, sometimes it's 
> quite a work.

They do now...

struct foo {}

enum Foo {
         @foo a
}

void main() {
         foreach(item; __traits(allMembers, Foo))
                 pragma(msg, __traits(getAttributes, 
__traits(getMember, Foo,
                 item)));
}


More information about the Digitalmars-d-learn mailing list