resetAllMembers

Reset all members in aggregate instance c.

void
resetAllMembers
(
T
)
(
T c
)
if (
is(T == class)
)

Examples

1 class C
2 {
3     this (int a, int b, string c)
4     {
5         this.a = a;
6         this.b = b;
7         this.c = c;
8     }
9     int a; int b; string c;
10 }
11 void f(C c)
12 {
13     c.resetAllMembers();
14 }
15 auto c = new C(1, 2, "3");
16 assert(c.a == 1);
17 assert(c.b == 2);
18 assert(c.c == "3");
19 f(c);
20 assert(c.a == 0);
21 assert(c.b == 0);
22 assert(c.c == null);

See Also

Meta