Understanding Safety of Function Pointers vs. Addresses of Functions

jmh530 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 8 14:04:26 PDT 2015


On Wednesday, 8 July 2015 at 18:31:00 UTC, Steven Schveighoffer 
wrote:
> You can use a function lambda:
>
> auto fp = (real a) => cos(a);
>
> Note, I had to put (real a) even though I would have expected 
> "a => cos(a)" to work.
>
> -Steve

Interesting. You have to put real because there is also a float 
and double version of cos.


More information about the Digitalmars-d-learn mailing list