digitalmars.D.learn - Specialize mixin templates
- Henning Pohl (8/8) Aug 11 2012 A struct takes a mixin template as argument:
- Timon Gehr (11/19) Aug 11 2012 This is a way to do it:
- Henning Pohl (3/28) Aug 12 2012 I've already found another way, but I think this proposal seems
A struct takes a mixin template as argument: struct S(alias Mixin) { mixin Mixin; } How to specialize a mixin template like this one to pass to S? mixin template MixinTemplate(T) { } S(MixinTemplate!float); // Something like this
Aug 11 2012
On 08/11/2012 11:42 PM, Henning Pohl wrote:A struct takes a mixin template as argument: struct S(alias Mixin) { mixin Mixin; } How to specialize a mixin template like this one to pass to S? mixin template MixinTemplate(T) { } S(MixinTemplate!float); // Something like thisThis is a way to do it: struct S(alias Mixin){ mixin Mixin; } mixin template MixinTemplate(T){ } mixin template MixinTemplateFloat(){ mixin MixinTemplate!float; } S!MixinTemplateFloat s;
Aug 11 2012
On Sunday, 12 August 2012 at 02:32:30 UTC, Timon Gehr wrote:On 08/11/2012 11:42 PM, Henning Pohl wrote:I've already found another way, but I think this proposal seems cleaner, thank you.A struct takes a mixin template as argument: struct S(alias Mixin) { mixin Mixin; } How to specialize a mixin template like this one to pass to S? mixin template MixinTemplate(T) { } S(MixinTemplate!float); // Something like thisThis is a way to do it: struct S(alias Mixin){ mixin Mixin; } mixin template MixinTemplate(T){ } mixin template MixinTemplateFloat(){ mixin MixinTemplate!float; } S!MixinTemplateFloat s;
Aug 12 2012