Infer function template parameters
Jonas Drewsen
jdrewsen at nospam.com
Thu Sep 20 12:57:47 PDT 2012
In foreach statements the type can be inferred:
foreach (MyFooBar fooBar; fooBars) writeln(fooBar);
same as:
foreach (foobar; fooBars) writeln(fooBar);
This is nice and tidy.
Wouldn't it make sense to allow the same for function templates
as well:
auto min(L,R)(L a, R b)
{
return a < b;
}
same as:
auto min(a,b)
{
return a < b;
}
What am I missing (except some code that needs chaging because
only param type and not name has been specified in t?
/Jonas
More information about the Digitalmars-d
mailing list