Accessing Private Fields from Outside
Adam D. Ruppe
destructionator at gmail.com
Tue May 17 17:56:35 PDT 2011
> Thanks, but traits doesn't really let me read or write to the
> variable though. :(
Use getMember there.
foreach(member; __traits(allMembers, TYPE))
__traits(getMember, instance_of_type, member) = something;
tupleof is probably better for this though, since it only includes
actual data members; it excludes methods.
You can write to tupleof by using an index.
More information about the Digitalmars-d
mailing list