lazy construction of an immutable object
Meta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 16 06:41:50 PDT 2014
On Wednesday, 16 July 2014 at 00:38:46 UTC, Puming wrote:
> 3. define all classes and use template magic to generate
> companion builders just like protobuffer does. But that would
> be complicated and I don't know how to do it. Do you have any
> suggestion for this approach?
This would probably be a good solution, but it will be a bit
tricky to generate the builder classes. Certainly doable. Take a
look at std.traits: FieldTypeTuple and RepresentationTypeTuple,
and the built in __traits(allMembers, <symbol>).
More information about the Digitalmars-d-learn
mailing list