For example: import std.conv; T a(T)(int a) { return to!T(a); } void main(){ string x = a(2); }
D is not able to deduce T. Can we make it possible to deduce template arguments from where the return value is assigned to?
Rust is able to do this: fn main() { let a : Vec<i32> = Vec::new(); } (In fact, you can even do this is Rust: fn main() { let mut a = Vec::new(); a[0] = 0i32; })