Christopher Wright schrieb:
On the other hand, you can get the non-final, non-private methods of a class with something like:
foreach (member; __traits (allMembers, Class))
{
    foreach (overload; __traits (getVirtualFunctions, Class, member))
    {
        // do stuff
    }
}

Naturally, __traits and foreach don't mix, so you'll have to use template recursion. This is pretty damn ugly.


But why doesn't that work? It doesn't even work when forced to run at compile time by CTFE. Had a look at the compiler code, it uses the same mechanism as pragma(msg, for example, so shouldn't something like the above theoretically be possible?

Reply via email to