set

Generic Member Setter.

ref
T
set
(
string member
T
U
)
(
auto ref T a
,
in U value
)
if (
isAggregateType!T &&
__traits(hasMember, T, member)
)

Examples

class C { int x, y, z, w; }
auto c = new C().set!`x`(11).set!`w`(44);
assert(c.x == 11);
assert(c.w == 44);

See Also

Meta