Get the return type of the function

tsbockman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 3 21:50:05 PST 2016


On Thursday, 4 February 2016 at 02:06:00 UTC, xtreak wrote:
> On Wednesday, 3 February 2016 at 23:57:12 UTC, Ivan Kazmenko 
> wrote:
>> 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.

See my PR for a workaround: 
https://github.com/D-Programming-Language/phobos/pull/3969/files


More information about the Digitalmars-d-learn mailing list