tobkit/libsigc++-2.2.3/docs/reference/html/group__lambdas.html
2009-12-29 11:14:14 +00:00

61 lines
4.5 KiB
HTML

<!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> &nbsp;
<a class="qindex" href="modules.html">Groups</a> &nbsp;
<a class="qindex" href="namespaces.html"> Namespaces</a> &nbsp;
</center>
<hr width="100%"/>
<!-- Generated by Doxygen 1.5.1 -->
<h1>Lambdas</h1>
<p>
Collaboration diagram for Lambdas:<center><table><tr><td><img src="group__lambdas.png" border="0" alt="" usemap="#group____lambdas_map">
<map name="group____lambdas_map">
<area href="group__group__.html" shape="rect" coords="135,5,201,32" alt="">
</map></td></tr></table></center>
libsigc++ ships with basic lambda functionality and the <a class="el" href="namespacesigc.html#d36281e6ca158599b36980a801f41aac">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">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__.html">group()</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><a class="el" href="namespacesigc.html#d36281e6ca158599b36980a801f41aac">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 &nbsp;</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">&nbsp;</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 &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsigc_1_1lambda.html">sigc::lambda&lt;T_type&gt;</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</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#d36281e6ca158599b36980a801f41aac">sigc::group</a> adaptor that uses lambdas to transform a functor's parameter list.
<p>
The lambda selectors <a class="el" href="namespacesigc.html#e97b63f5ec67f39d2e69a746766872ee">sigc::_1</a>, <a class="el" href="namespacesigc.html#b94262522878fd819509b356dcd99ca3">sigc::_2</a>, ..., sigc::_9 are used to select the first, second, ..., nineth argument from a list.<p>
<dl class="user" compact><dt><b>Examples:</b></dt><dd><div class="fragment"><pre class="fragment"> std::cout &lt;&lt; <a class="code" href="namespacesigc.html#e97b63f5ec67f39d2e69a746766872ee">sigc::_1</a>(10,20,30); <span class="comment">// returns 10</span>
std::cout &lt;&lt; <a class="code" href="namespacesigc.html#b94262522878fd819509b356dcd99ca3">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 class="user" compact><dt><b>Examples:</b></dt><dd><div class="fragment"><pre class="fragment"> std::cout &lt;&lt; (<a class="code" href="namespacesigc.html#e97b63f5ec67f39d2e69a746766872ee">sigc::_1</a> + 5)(3); <span class="comment">// returns (3 + 5)</span>
std::cout &lt;&lt; (<a class="code" href="namespacesigc.html#e97b63f5ec67f39d2e69a746766872ee">sigc::_1</a> * <a class="code" href="namespacesigc.html#b94262522878fd819509b356dcd99ca3">sigc::_2</a>)(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.5.1 &copy;&nbsp;1997-2001</small></address>
</body>
</html>