Named arguments

jmh530 john.michael.hall at gmail.com
Wed Oct 25 16:40:52 UTC 2017


On Wednesday, 25 October 2017 at 15:33:05 UTC, bauss wrote:
>
> That depends. It's a common pattern in D to pass them as 
> template parameters, in fact most functionality in 
> std.algorithm supports it.

std.algorithm has a lot of passing lambdas as template 
parameters, but not so much for parameters you would expect to be 
run-time parameters.

Consider count:
size_t count(alias pred = "a == b", Range, E)(Range haystack, E 
needle)
it's not
size_t count(alias pred = "a == b", Range haystack, E needle, 
Range, E)()


More information about the Digitalmars-d mailing list