Anonymous function: Difference between revisions

Content deleted Content added
C++ (since C++11): Updated the generic lambda syntax
Line 732:
Since [[C++14]], the function parameters of a lambda can be declared with <code>auto</code>. The resulting lambda is called a ''generic lambda'' and is essentially an anonymous function template since the rules for type deduction of the auto parameters are the rules of template argument deduction. As of [[C++20]], template parameters can also be declared explicitly with the following syntax:
<syntaxhighlight lang="cpp">
[ captures ] < tparams > requires (optional) ( params ) specs requires (optional) { body }
[capture] <tparameters> (parameters) trailing_return_type { function_body }
</syntaxhighlight>