Named arguments

Jacob Carlborg doob at me.com
Fri Oct 27 06:45:03 UTC 2017


On 2017-10-25 16:58, jmh530 wrote:

> You're passing the function arguments as template parameters. Usually 
> you want them to be able to be passed at run-time.

No problem:

$ cat main.d

import std.stdio;

void foo(args...)()
{
     writeln(args);
}

void main(string[] args)
{
     foo!(args);
}

$ dmd main.d
$ ./main foo bar
["./main", "foo", "bar"]

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list