Named arguments

jmh530 john.michael.hall at gmail.com
Wed Oct 25 14:58:50 UTC 2017


On Wednesday, 25 October 2017 at 12:40:47 UTC, Bastiaan Veelo 
wrote:
> [snip]
>
> int first = 1;
> void main()
> {
>     // Ordinary:
>     foo(first, 2, 3.0, "4");    // Prints one=1; two=2; 
> three=3; four=4
>     // Named arguments:
>     named!(foo, "four", "4",
>                 "two", 2,
>                 "one", first,
>                 "three", 3.0);  // idem
> }


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


More information about the Digitalmars-d mailing list