On Thursday, 3 December 2015 at 21:04:00 UTC, Nordlöw wrote:
Givenclass 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 alongforeach(ref member; __traits(allMembers, c)) { member = typeof(member).init; }
Won't clear(c); do the trick? ((pp187-188 of TDPL)