On Tue, Jul 16, 2013 at 7:52 PM, JS <js.m...@gmail.com> wrote: > > It seems that one must use two templates to process built in times and > strings > > template A(string a) { ... } > template A(a) { enum A = A(typeof(a).stringof); } > > This is so we can do stuff like A!(double) and A!("double"). > > The problem is when we have many parameters the number of permutations > increases exponentially. > > Is there a better way to unify the two? >
template a(T...)if(T.length==1){ enum a=1; } void main(){ auto a1=a!double; auto a2=a!"double"; } However: This syntax sucks. Why not support the following syntax: template a(auto T) {...} with same semantics? Because this is problematic with more arguments: I'd like this: template a(auto T1, double T2){...} but instead have to do that: template a(T...)if(is(T[1]==double)) {...} and it gets quickly more complicated