On 8/2/2013 1:34 PM, SteveGuo wrote:
I'm not an expert on programming language, if I made a naive issue, just forgive
me:p

We never forgive, and the internet never forgets! :-)


Can we declare a template function like this?

auto Add(a, b) // Note a, b do not have type, that means a and b use template 
type
{
     return a + b;
}

auto Sub(a, int b) // a uses template type, b is fixed to int
{
     return a - b;
}

The trouble with this is that sometimes people will use a type without an identifier in order to indicate that the parameter is not used:

auto Foo(int, unsigned x)

But also note that for lambdas, D does allow the form you suggest, as there weren't backwards compatibility issues with it.

Reply via email to