dupMembers

@safe pure nothrow
T
dupMembers
(
T
)
(
T x
)
if (
is(T == struct)
)

Return Value

Type: T

Copy of x where each members m is duplicated via m.dup if possible.

Examples

struct S {
	int ia;
	int ib;
	string s; // @gc
}
S x = { ia: 42, ib: 43, s: "abc" };
auto y = x.dupMembers;
assert(x == y);
assert(x.s !is y.s);

Meta