Can't use variadic arguments to functions that use templates

JS js.mdnq at gmail.com
Tue Jul 23 09:22:37 PDT 2013


On Tuesday, 23 July 2013 at 16:15:03 UTC, Jesse Phillips wrote:
> On Tuesday, 23 July 2013 at 14:03:01 UTC, JS wrote:
>> I don't think you understand(or I've already got confused)...
>>
>> I'm trying to use B has a mixin(I don't think I made this 
>> clear). I can't use it as a normal function. e.g., I can't 
>> seem to do mixin(B(t)). If I could, this would definitely 
>> solve my problem.
>
> I'll stick with the reduced example, maybe you can apply it to 
> the real world:
>
>    template B(T...) {
>       string B(T b) {
>          string s;
>          foreach(i, Type; T)
>             s ~= Type.stringof ~ " " ~ b[i] ~ ";\n";
>          return s;
>       }
>    }
>
>    void main() {
>       enum forced = B("x", "a", "b");
>       pragma(msg, forced);
>       mixin(forced);
>    }

What good does that do?

What if I want to use a run-time variable in the mix?



More information about the Digitalmars-d-learn mailing list