Get the return type of the function
xtreak via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Feb 3 18:06:00 PST 2016
On Wednesday, 3 February 2016 at 23:57:12 UTC, Ivan Kazmenko
wrote:
> On Wednesday, 3 February 2016 at 22:09:37 UTC, sigod wrote:
>> On Wednesday, 3 February 2016 at 19:21:06 UTC, Meta wrote:
>>> 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
>
> Seems reasonable: `(int a) => a * a` has return type `int` but
> just `(a) => a * a` does not yet know the type of `a`, and so
> can not tell the return type.
Thanks for the reply. But the issue was about knowing the type of
lambda in map. Most people won't enter the type of argument in a
map. Is there a way to detect the return type will be non void. I
don't need to know the type I just wanr to verify its not void.
Yes * can be overloaded and can have different types based on the
input having the overloaded operator implemented. I just want to
check if the return type is not void.
More information about the Digitalmars-d-learn
mailing list