When iterating through class members using traits how do you
filter out the member vars to only get a list of methods. I think
i've solved it in the code below but it feels like i am abusing
MemberFunctionsTuple. Is this the correct way to do this?
private template Methods(T, int index = 0)
{
private string getMethods()
{
string code = "";
static if (index < __traits(allMembers, T).length)
{
static if (MemberFunctionsTuple!(T, __traits(allMembers,
T)[index]).length)
{
code ~= __traits(allMembers, T)[index] ~ "\n";
}
code ~= Methods!(T, index + 1);
}
return code;
}
enum Methods = getMethods();
}