This code import std.stdio; import std.typecons; template mytemp(T...) { static if(T.length == 1) enum mytemp = tuple(T[0]); else enum mytemp = tuple(T[0], mytemp!(T[1..$]).expand); } void main() { writeln(mytemp!(5)); writeln(mytemp!(5, 10, 7)); writeln(mytemp!(true)); writeln(mytemp!(true, false, true)); writeln(mytemp!("hello")); writeln(mytemp!("hello", "world")); } results in this output Tuple!(int)(0) Tuple!(int,int,int)(0, 0, 0) Tuple!(bool)(false) Tuple!(bool,bool,bool)(false, false, false) Tuple!(string)() Tuple!(string,string)(, ) If I change it to import std.stdio; import std.typecons; template mytemp(T...) { enum mytemp = T[0]; } void main() { writeln(mytemp!(5)); writeln(mytemp!(true)); writeln(mytemp!("hello")); } I get 5 true hello So obviously, there's something wrong with tuple here. And it's pretty crippling for my current project actually.
Seem to work with dmd 2.058