Template functions, can we make it more simple?

monarch_dodra monarchdodra at gmail.com
Fri Aug 2 15:03:56 PDT 2013


On Friday, 2 August 2013 at 22:00:44 UTC, SteveGuo wrote:
>
>> He meant that when you only have a single token it is parsed 
>> as PARAMTYPE and not varname.
>>
>> EG:
>>
>> void foo(int);
>
> Thanks for pointing out my misunderstanding.
>
> But we can make a compiler which can "understand" what we want 
> it understand.
>
> void foo(int); // this is just a declaration, not a definition
>
> auto foo(a) // this is a definition, with a function body, they 
> are different
> {
> }

No difference.

void foo(int)
{}

Is perfectly legal.


More information about the Digitalmars-d mailing list