Parameterized template value parameter

Yuxuan Shui via Digitalmars-d digitalmars-d at puremagic.com
Thu Mar 23 16:24:15 PDT 2017


So I was trying to make my template take a value parameter, whose 
type is also a parameter to the template. e.g.:

     template A(Char[] str, Char);

But dmd complains about 'Char' being undefined. I have to write:

     template A(Char, Char[] str);

Which is inconvenient, because now 'Char' can't be deduced by the 
compiler.

Can we make the first case work?


More information about the Digitalmars-d mailing list