Enum template with mixin, need 'this'
Meta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Dec 24 12:20:14 PST 2014
On Wednesday, 24 December 2014 at 20:08:07 UTC, Meta wrote:
> I am curious, however, why changing `enum` to `auto` (or bool)
> doesn't work. You said that the mixin tries to interpret the
> expression `cast(bool)(embeddedTest.bits & <enumName>)` at
> compile time, but I don't understand why that would be so when
> the storage is auto and not enum. I guess mixin doesn't work
> quite like I thought it did; it's not quite the equivalent of
> pasting the mixed-in code.
Ok, I understand now. I missed the fact that even when it's an
auto or a bool variable, it is CTFE-initialized because it's
outside the constructor. I'm so close, yet so far from making
this work.
More information about the Digitalmars-d-learn
mailing list