catchy phrase for this idiom?
Tim M
a at b.com
Sun Mar 15 15:47:59 PDT 2009
On Sun, 15 Mar 2009 06:27:42 +1300, BCS <none at anon.com> wrote:
>
> there is no compact form for alias but this
>
> T Foo(T)(T t) { return t; }
>
> is internally identical the the more verbose form:
>
> template Foo(T) { T Foo(T t){ return t; } }
>
>
Hi BCS. On this page: http://www.digitalmars.com/d/1.0/template.html
scroll down to "Implicit Template Properties" and it says:
"If a template has exactly one member in it, and the name of that member
is the same as the template name, that member is assumed to be referred to
in a template instantiation".
I think Andrei Alexandrescu was actually looking a catchy name for this.
You don't have to specify the templates only property, you use the
template directly. So its a technique used to make your code less verbose.
More information about the Digitalmars-d
mailing list