More lambda support - for optional lambda declarators
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@13859 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7ca8f025ad
commit
35458b4a5d
3 changed files with 33 additions and 12 deletions
|
|
@ -217,14 +217,29 @@ ignores it.</p>
|
|||
<H3><a name="Cpp0x_Lambda_functions_and_expressions"></a>7.2.8 Lambda functions and expressions</H3>
|
||||
|
||||
|
||||
<p>SWIG correctly parses the Lambda functions syntax. For example:</p>
|
||||
<p>SWIG correctly parses most of the Lambda functions syntax. For example:</p>
|
||||
<div class="code"><pre>
|
||||
auto val = [] { return something; };
|
||||
auto sum = [](int x, int y) { return x+y; };
|
||||
auto sum = [](int x, int y) -> int { return x+y; };
|
||||
</pre></div>
|
||||
|
||||
<p>The lambda functions are removed from the wrapper class for now, because of the lack of support
|
||||
for closures (scope of the lambda functions) in the target languages.</p>
|
||||
|
||||
<p>
|
||||
Lambda functions used to create variables can also be parsed, but due to limited support of <tt>auto</tt> when
|
||||
the type is deduced from the expression, the variables are simply ignored.
|
||||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
auto six = [](int x, int y) { return x+y; }(4, 2);
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
Better support should be available in a later release.
|
||||
</p>
|
||||
|
||||
<H3><a name="Cpp0x_Alternate_function_syntax"></a>7.2.9 Alternate function syntax</H3>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue