Examining Members of a module at Compile Time
Dicebot via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu May 29 16:18:30 PDT 2014
class Test {}
class TestChild: Test {}
class TestChildChild: TestChild {}
alias Alias(alias Symbol) = Symbol; // this does the trick
void main()
{
foreach (item; __traits(allMembers, mixin(__MODULE__)))
{
alias sym = Alias!(__traits(getMember, mixin(__MODULE__),
item));
static if (is(sym == class))
{
pragma(msg, item);
}
}
}
// http://dpaste.dzfl.pl/e3ce615ca188
More information about the Digitalmars-d-learn
mailing list