On Sunday, 2 July 2023 at 20:27:47 UTC, Steven Schveighoffer wrote:
On 7/2/23 1:02 PM, Paul wrote:
[...]

Use a static foreach:

```d
import std.traits; // for FieldNameTuple. there are other ways, but this is the most straightforward
switchlabel: // this is needed for break inside a static foreach
final switch(s) {
   static foreach(mem; FieldNameTuple!myS) {
     case mem ~ mem:
        __traits(getMember, this, mem) += n;
        break switchalbel;
   }
}
```

-Steve

Perfect.  Thanks Steve!

Reply via email to