具有一个模板的功能
import std.stdio;
T min(T)(in T arg1, in T arg2) {
return arg1 < arg2 ? arg1 : arg2;
}
void main() {
//Automatic type inference
writeln(min(1, 2));
//Explicit type
writeln(min!(ubyte)(1, 2));
//With single type, the parenthesis might be ommited
writeln(min!ubyte(1, 2));
}