A little thing about function templates

mike vertex at gmx.at
Mon Feb 12 05:09:29 PST 2007


Hi!

I've got a little theoretical question about function template syntax:

A function is declared like

' void foo(int xy) { ... }

and called like

' foo(3);

a function template is declared like

' void foo(T)(T xy) { ... }

and "called" like

' foo!(int)(3);

Now basically what I'm thinking is that if a "function call" has two sets  
of parenthesis, it should be enough for the compiler to know that it's a  
function template:

' void foo(T)(T x) { ... }
' foo(int)(3);

Maybe there's some ambiguity with functions that return a delegate, I  
haven't thought about that, since this isn't a feature request, just  
something that occured to me and I just wanted to hear what the experts  
have to say to it :)
I'm not complaining about the !, just wanted to know if it really is  
necessary or if it would work with only parentheses.

-Mike

-- 
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/



More information about the Digitalmars-d mailing list