Function parameters UDAs

Machine Code jckj33 at gmail.com
Tue Jun 11 02:41:55 UTC 2019


On Tuesday, 11 June 2019 at 02:24:49 UTC, Adam D. Ruppe wrote:
> 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)));
> }

Awesome! It came out and I didn't notice.


More information about the Digitalmars-d-learn mailing list