[Issue 17974] getSymbolsByUDA is returns unusable symbols when used in foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 9 14:10:37 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17974

--- Comment #3 from Artem Borisovskiy <kolos80 at bk.ru> ---
Thanks, but I already found another way of doing it, by using
__traits(getMember...). Anyway, both my and your solutions are ugly hacks. They
make code even less readable than it was before. It's possible to get rid of
some repetition, though:

alias symbols = getSymbolsByUDA!(FUBAR, Attr);
static foreach (i; symbols.length.iota)
    pragma(msg, getUDAs!(symbols[i], Attr));

Still, `static foreach (symbol; getSymbolsByUDA!(FUBAR, Attr))' would be nicer.

--


More information about the Digitalmars-d-bugs mailing list