Mixin template, "no identifier for declarator"

Andrea Fontana via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 27 01:41:21 PDT 2015


On Tuesday, 27 October 2015 at 07:56:51 UTC, SimonN wrote:
> Hi,
>
> I'd like to generate several very similar class methods with a 
> mixin template.
> The mixin template shall take alias parameters, so that 
> different methods can
> bind it to different fields. Reduced problem case:

Template mixins can be used only for declaration.
Probably what you need is a (non-template) mixin.

Check this: http://dlang.org/mixin.html

You should generate code you need and then mixin it.




More information about the Digitalmars-d-learn mailing list