On Monday, 22 October 2018 at 10:16:22 UTC, test wrote:
I try use traits get all public static function of a struct pass to template...

how to do this ?

void allFunctions(T)() {
    import std.stdio;
    foreach (name; __traits(allMembers, T)) {
static foreach (overload; __traits(getOverloads, T, name)) { static if (__traits(getProtection, overload) == "public" && __traits(isStaticFunction, overload)) { // 'overload' is an alias to a T's public static function
                writeln(name, ": ", typeof(overload).stringof);
            }
        }
    }
}

Reply via email to