On Wednesday, 4 May 2016 at 10:58:04 UTC, chmike wrote:
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 ?

Yes this is equivalent, the parens are not required. With a delegate literal they are: "auto foo = Foo!((a){a.writeln;})("hello");

Reply via email to