On Friday, 19 April 2024 at 22:24:17 UTC, Liam McGillivray wrote:
```
template enumMixin(alias Enum) {
static foreach(m; __traits(allMembers, Enum)) static if (!__traits(isDeprecated, __traits(getMember, Enum, m)))
    {
        mixin("alias "~m~" = __traits(getMember, Enum, m);");
    }
};
```

Correction: The code shown above actually *does* work properly without any deprecation warnings. I made a mistake with the enum being set to the CTFE function I was previously using instead of this template. This template actually works.

I posted here for visibility and searchability, in case anyone else wants to do something like this.

Reply via email to