switch to member
Ivan Kazmenko via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jan 14 03:44:48 PST 2017
On Saturday, 14 January 2017 at 11:32:10 UTC, Marc Schütz wrote:
> You can utilize a little-known `switch` syntax trick in
> combination with `foreach`. Because a `foreach` over tuples is
> unrolled at compile time, it works even if your fields don't
> have exactly the same types:
>
> <snip>
That looks concise. Perhaps enum Which can also be automatically
filled by __traits (allMembers) or std.traits.Fields if needed.
More information about the Digitalmars-d-learn
mailing list