[Proposal] "Name inference" for function templates

Sean Kelly sean at f4.ca
Thu Jun 15 20:15:02 PDT 2006


Markus Dangl wrote:
> 
> http://www.digitalmars.com/d/template.html
> If there's only a single declaration, you can even write:
> 
> T sqr(T) ( T x )
> {
>     return x*x;
> }
> 
> Which is already in the language and even shorter than your proposal ;)
> This is the same for class templates.

Huh.  I don't see any mention of that syntax being legal in the docs, 
but it works.  And to think I wanted to propose this a while back--I 
should have just tried it out. :-)


Sean



More information about the Digitalmars-d mailing list