Types of lambda args

Steven Schveighoffer schveiguy at gmail.com
Mon Aug 17 00:31:08 UTC 2020


On 8/16/20 8:27 PM, Adam D. Ruppe wrote:
> On Monday, 17 August 2020 at 00:20:24 UTC, Cecil Ward wrote:
>> In a lambda, how do we know what types the arguments are? In something 
>> like
>>     (x) => x * x
> 
> In that the compiler figures it out from usage context. So if you pass 
> it to a int delegate(int), it will figure x must be int.

It's actually a template, with some special benefits. It relies on IFTI 
to work.

-Steve


More information about the Digitalmars-d-learn mailing list