1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>libsigc++ 2.0: Lambdas</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff">
<table border="0" width="100%">
<tr>
<td width="10%" height="40"><img src="../../images/libsigc_logo.gif" alt="logo" border="0" width="100%" height="100%"/></td>
<td width="90%" height="40"><img src="../../images/top.gif" alt="top" width="100%" height="40"/></td>
</tr>
</table>
<center>
<a class="qindex" href="../../index.html">Main Page</a>
<a class="qindex" href="modules.html">Groups</a>
<a class="qindex" href="namespaces.html"> Namespaces</a>
</center>
<hr width="100%"/>
<!-- Generated by Doxygen 1.3.9.1 -->
<h1>Lambdas</h1>libsigc++ ships with basic lambda functionality and the <a class="el" href="namespacesigc.html#a44">sigc::group</a> adaptor that uses lambdas to transform a functor's parameter list.
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Modules</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">group </td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__.html">group()</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="namespacesigc.html#a44">sigc::group()</a> alters an arbitrary functor by rebuilding its arguments from one or more lambda expressions. <br></td></tr>
<p>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1lambda__base.html">sigc::lambda_base</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">A hint to the compiler. <a href="structsigc_1_1lambda__base.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1lambda.html">sigc::lambda<T_type></a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Lambda type. <a href="structsigc_1_1lambda.html#_details">More...</a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
libsigc++ ships with basic lambda functionality and the <a class="el" href="namespacesigc.html#a44">sigc::group</a> adaptor that uses lambdas to transform a functor's parameter list.
<p>
The lambda selectors <a class="el" href="namespacesigc.html#a0">sigc::_1</a>, <a class="el" href="namespacesigc.html#a1">sigc::_2</a>, ..., sigc::_9 are used to select the first, second, ..., nineth argument from a list.<p>
<dl compact><dt><b>Examples:</b></dt><dd><div class="fragment"><pre class="fragment"> std::cout << <a class="code" href="namespacesigc.html#a0">sigc::_1</a>(10,20,30); <span class="comment">// returns 10</span>
std::cout << <a class="code" href="namespacesigc.html#a1">sigc::_2</a>(10,20,30); <span class="comment">// returns 20</span>
...
</pre></div></dd></dl>
Operators are defined so that lambda selectors can be used e.g. as placeholders in arithmetic expressions.<p>
<dl compact><dt><b>Examples:</b></dt><dd><div class="fragment"><pre class="fragment"> std::cout << (sigc::_1 + 5)(3); <span class="comment">// returns (3 + 5)</span>
std::cout << (sigc::_1 * sigc::_2)(7,10); <span class="comment">// returns (7 * 10)</span>
</pre></div></dd></dl>
<hr><address><small>
Generated for libsigc++ 2.0 by <a href="http://www.doxygen.org/index.html">
Doxygen</a> 1.3.9.1 © 1997-2001</small></address>
</body>
</html>
|