Template functions, can we make it more simple?

SteveGuo steveguo at outlook.com
Fri Aug 2 16:03:36 PDT 2013


> I like this syntax.
>
> I'm worried, though, about how it will interact with explicit 
> template
> parameters. E.g., how would you express this:
>
> 	bool func(R,T,U)(T t, U u) { ... }
>
> in the new syntax?
>
> 	bool func(R)(auto t, auto u) { ... }
>
> ?
>
> What if we have variadics on either side?
>
> I'm still on the fence as to whether we should add the new 
> syntax, nice
> as it is. The current syntax is far more unambiguous, and 
> allows you to
> specify signature constraints on the input types directly, as 
> well as
> use it in the return type spec, without needing to say 
> typeof(t) or
> typeof(u).
>
>
> T

If these syntax is feasible to template functions, is it possible 
to apply it to class template?

class A
{
     int a; // normal member
     auto b; // template member?
}


More information about the Digitalmars-d mailing list