On 2013-05-13 04:37, Timothee Cour wrote:
A proposed feature of C++14 is to introduce template parameter deduction for constructors, see paper, mentioned here. The idea is to deduce template parameters when calling a constructor given the arguments given to the constructor, whenever possible. A compile error occurs when the deduction is ambiguous. The benefits would be: * make the code more DRY * make boilerplate of class instantiators unnecessary in most cases (they're all over phobos, eg: std.typecons.tuple, std.typecons.rebindable etc) * make D more consistent: it deduces template parameters for functions, so why not for constructors, when this is unambiguous? * it won't break any code. Note, just as for deduction of normal functions, it should work with 0 or more template parameters specified (ie the first k>=0 templates may be provided).
I definitely want this. -- /Jacob Carlborg
