Type inference of a function parameter

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 29 13:37:34 PDT 2015


On Wednesday, 29 July 2015 at 20:20:47 UTC, Adel Mamin wrote:
> void my_func(auto arr)
> {
>   writeln(arr);
> }

There are no `auto` parameters in D. You have to make it a 
template explicitly:

----
void my_func(A)(A arr)
{
   writeln(arr);
}
----



More information about the Digitalmars-d-learn mailing list