Template args to UDA's

Diggory diggsey at googlemail.com
Tue May 28 17:46:37 PDT 2013


On Tuesday, 28 May 2013 at 13:41:42 UTC, Manu wrote:
> So I've run into an expression I need to be able to implement 
> std.simd
> properly for GDC/LDC.
>
> Doesn't work:
>   @attribute("target", T) void func(string T)(...);
>
> In this case, currently, the UDA can't receive the template arg 
> that was
> given to the function.
>
> I require that attributes on templates be able to make use of 
> the template
> args, since the template arg given may affect the attribute in 
> some
> circumstances.

Can you not move the template outside the attribute like this?:

template func(string T) {
     @attribute("target", T) void func(...);
}


More information about the Digitalmars-d mailing list