why return type must be specified for higher-order lambda functions

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello,

<pre class="prettyprint" style=" auto higherOrderFunction = [] (int x) <strong style="color:red -> function<int (int)> {
return [x](int y){
return x * y;
};
};[/code]
MSDN says:"<span style="color:#2a2a2a; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif You can
omit the return type part of a lambda expression if the lambda body contains
a single return statement or the lambda expression does not return a value." <span style="font-size:0.75em; line-height:1.5
So why "-> function<int (int)>" must be specified? <br/>

View the full article
 
Back
Top