On Wed, 24 Dec 2014 17:05:45 +0000 Meta via Digitalmars-d-learn <[email protected]> wrote:
> So `if (isSet!bit1)` becomes `if (cast(bool)(embeddedTest.bits & > bit1)`. That doesn't work, however. I get an error message saying > "need 'this' for 'bits' of type 'int'". Is there a way to make > this work, or am I stuck with the uglier mixin at the usage site? i don't think that you can cheat like this. ;-) templates aren't macros, and `mixin` inside the template works immediately. i.e. it's trying to *execute* the mixined code in compile time. so your template with `mixin` in it tries to check `embedded.bits` in *compile* time, and then complains about missing 'this', as it should. i don't think that you can do c-like macros in D.
signature.asc
Description: PGP signature
