Get the return type of the function

sigod via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 3 14:09:37 PST 2016


On Wednesday, 3 February 2016 at 19:21:06 UTC, Meta wrote:
> On Wednesday, 3 February 2016 at 18:40:27 UTC, xtreak wrote:
>> Thanks. I was trying to get the return type of lambdas. I was 
>> trying the following and got an error. I was using dpaste with 
>> dmd 2.070
>>
>> writeln(ReturnType!(a =(a *a)))
>>
>> Error: template instance f662.main.ReturnType!((a) => a * a) 
>> does not match template declaration ReturnType(func...) if 
>> (func.length == 1 && isCallable!func)
>
> Ah, I see. I'd like to test something; can you please change 
> `(a) => a * a` to
> `(int a) => a * a` and post the results?

This works.

http://dpaste.dzfl.pl/92c254ef6cf6


More information about the Digitalmars-d-learn mailing list