Passing functions as template parameter and assigning default values to them

kerdemdemir via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 21 03:55:52 PDT 2015


On Sunday, 21 June 2015 at 10:06:15 UTC, biozic wrote:
> You can use a template alias parameter with a default value 
> that is your default lambda:
>
> int indexOfMax(alias fun = a => a, R)(R range)
> {
>     // Use `fun` here like a function.
> }
>
> -- Nico

Thanks a lot, it works !!


More information about the Digitalmars-d-learn mailing list