On Thursday, 29 May 2014 at 23:18:32 UTC, Dicebot wrote:
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

Thanks, that works. It's not a perfect solution, though. It will fail to fail if you pass it something beside a symbol, instead failing silently. But it works okay for my use case.

Reply via email to