```d struct myS { int a, b, c, d, e, f, g, h, i; adder(string s, int n) { final switch (s) { case "aa" : a += n; break; case "bb" : b += n; break; ... ``` Thanks for any assistance.
"macro" expansion to build switch case code
Paul via Digitalmars-d-learn Sun, 02 Jul 2023 10:06:59 -0700
I have a struct similar to the following example. I'd like to
build an adder method without having to code the whole method.
How do I use the D language to do this? Template, mixins,
CTFE..all of them?
- "macro" expansion t... Paul via Digitalmars-d-learn
- Re: "macro" ex... nbdusr via Digitalmars-d-learn
- Re: "macro" ex... kdevel via Digitalmars-d-learn
- Re: "macro" ex... Steven Schveighoffer via Digitalmars-d-learn
- Re: "macro"... Paul via Digitalmars-d-learn