http://dpaste.dzfl.pl/c250e798

import std.traits, std.range;

private template Methods(T)
        if (is(T == class))
{
        private string[] getMethods()
        {
                string result[];
                
                foreach (member_string; __traits(allMembers, T))
                {
mixin("alias member = " ~ T.stringof ~ "." ~ member_string ~ ";");
                        static if (is(typeof(member) == function))
                        {

                                result ~= __traits(identifier, member);
                        }
                }       
                return result;
        }
        
        enum Methods = getMethods().join("\n");
}

class A
{
        int a;
        void delegate() dg;
        void foo() { }
}

void main()
{
        pragma(msg, Methods!A);
}

Reply via email to