Code example for function/delegate as template argument ?

chmike via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 4 03:58:04 PDT 2016


On Wednesday, 4 May 2016 at 06:59:00 UTC, Basile B. wrote:
> . . .
> void main(string[] args)
> {
>     alias fun = (a) => a.writeln;
>     auto foo = Foo!fun("hello");
> }

Is this equivalent to Foo!(a => a.writeln) or is it required to 
split this in two instructions as you did ? I also thought the 
parenthesis around the lambda arguments are not required. Is that 
right ?




More information about the Digitalmars-d-learn mailing list