On Monday, 30 June 2025 at 21:37:20 UTC, bauss wrote:
the static foreach will emit all code in scope, which means each iteration will emit the code in the scope, so you double brace it to create individual scopes that don't "overlap".static foreach (field; B.tupleof) {{ enum s = __traits(identifier, field); pragma(msg, s); // access runtime field __traits(getMember, d, s)++; }}
Thank you. I hadn't thought of static foreach with that perspective before, but that makes sense.
Andy