New Traits

Jacob Carlborg doob at me.com
Thu May 17 03:30:26 PDT 2012


On 2012-05-16 23:19, John Maschmeyer wrote:

> It works for a function literal that has been assigned to a variable.
>
> Function Literal:
> int function(int) func = x => x+1;
> writeln(__traits(codeof, func));
> Outputs:
> int function(int) func = delegate pure nothrow @safe int(int x)
> {
> return x + 1;
> }
> ;

Does it work if the lambda is passed to a function:

void foo (int delegate (int x) dg)
{
     wirteln(__traits(codeof, dg);
}

foo(x => x + 1);

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list