Template functions, can we make it more simple?

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Aug 2 15:06:12 PDT 2013


On 8/2/13, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> auto fun(auto x, auto y) { … }
>
> Truth be told, at the time of that decision
> parameter names (viz. x and y) could not be used in template
> constraints. Now they could, so in a way that reopens the question.

You'd still have to use typeof(x) and typeof(y) to extract the types,
so even though you end up making the template declaration simpler you
also make the constraint more complicated.

Anyway after one uses templates for a longer while it becomes apparent
that they're rather easy to use in D.


More information about the Digitalmars-d mailing list