core.reflect vs. __traits

Steven Schveighoffer schveiguy at gmail.com
Sat Jul 3 13:09:26 UTC 2021


On 7/3/21 7:59 AM, Stefan Koch wrote:
>            result ~= "  " ~ m ~ " = " ~ to!string(cast(int)mixin("TOK." 
> ~ m)) ~ ",\n";

"because [the `__traits` version uses] a mixin"

What about:

```d
result ~= " " ~ m ~ " = " ~ to!string(int(__traits(getMember, TOK, m))) 
~ ",\n";
```

-Steve


More information about the Digitalmars-d mailing list