Get the return type of the function

xtreak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 3 09:12:03 PST 2016


I was reporting a patch for the regression by removing the code 
that was causing the error. The bug was that map was not 
accepting multiple lambdas. It was suggested to check for void 
functions and lambdas. I couldn't find a function to check for 
return type in the std.traits. I tried the explicit for loop thus 
checking for the void functions as in the else case. I am D 
newbie it will be helpful in having the community help me in 
fixing the issue.

foreach(g, i; fun) {
   alias k = unaryFun!(fun[g]);
   static assert(!is(AppliedReturnType!k == void), "Mapping 
function must not return void.");
}

Bug report : https://issues.dlang.org/show_bug.cgi?id=15480
Seems depends on : https://issues.dlang.org/show_bug.cgi?id=5710
Pull request : 
https://github.com/D-Programming-Language/phobos/pull/3963
Introduced as a part of 
https://github.com/D-Programming-Language/phobos/pull/1917


More information about the Digitalmars-d-learn mailing list