Given

    class C
    {
        // lots of members
    }

and a function

    f(C c)
    {
    }

is there a generic way, perhaps through reflection, to reset (inside f) all members of `c` to their default values? Something along

    foreach(ref member; __traits(allMembers, c))
    {
        member = typeof(member).init;
    }

Reply via email to