Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/doc/html/lambda.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 14.8 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>Chapter 6. Boost.Lambda</title>
5<link rel="stylesheet" href="boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
7<link rel="start" href="index.html" title="The Boost C++ Libraries">
8<link rel="up" href="libraries.html" title="Part I. The Boost C++ Libraries">
9<link rel="prev" href="hash/acknowledgements.html" title=" Acknowledgements">
10<link rel="next" href="lambda/getting_started.html" title="Getting Started">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%">
14<td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../boost.png"></td>
15<td align="center"><a href="../../index.htm">Home</a></td>
16<td align="center"><a href="../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="../../people/people.htm">People</a></td>
18<td align="center"><a href="../../more/faq.htm">FAQ</a></td>
19<td align="center"><a href="../../more/index.htm">More</a></td>
20</table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="hash/acknowledgements.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="lambda/getting_started.html"><img src="images/next.png" alt="Next"></a>
24</div>
25<div class="chapter" lang="en">
26<div class="titlepage"><div>
27<div><h2 class="title">
28<a name="lambda"></a>Chapter 6. Boost.Lambda</h2></div>
29<div><div class="author">
30<h3 class="author">
31<span class="firstname">Jaakko</span> <span class="surname">Järvi</span>
32</h3>
33<code class="email">&lt;<a href="mailto:jarvi%20at%20cs%20tamu%20edu">jarvi at cs tamu edu</a>&gt;</code>
34</div></div>
35<div><p class="copyright">Copyright © 1999-2004 Jaakko Järvi, Gary Powell</p></div>
36<div><div class="legalnotice">
37<a name="id2706954"></a><p>Use, modification and distribution is subject to the Boost
38    Software License, Version 1.0. (See accompanying file
39    <code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</p>
40</div></div>
41</div></div>
42<div class="toc">
43<p><b>Table of Contents</b></p>
44<dl>
45<dt><span class="section"><a href="lambda.html#introduction">In a nutshell</a></span></dt>
46<dt><span class="section"><a href="lambda/getting_started.html">Getting Started</a></span></dt>
47<dd><dl>
48<dt><span class="section"><a href="lambda/getting_started.html#id2707059">Installing the library</a></span></dt>
49<dt><span class="section"><a href="lambda/getting_started.html#id2707319">Conventions used in this document</a></span></dt>
50</dl></dd>
51<dt><span class="section"><a href="lambda/s03.html">Introduction</a></span></dt>
52<dd><dl>
53<dt><span class="section"><a href="lambda/s03.html#id2707350">Motivation</a></span></dt>
54<dt><span class="section"><a href="lambda/s03.html#id2707599">Introduction to lambda expressions</a></span></dt>
55</dl></dd>
56<dt><span class="section"><a href="lambda/using_library.html">Using the library</a></span></dt>
57<dd><dl>
58<dt><span class="section"><a href="lambda/using_library.html#lambda.introductory_examples">Introductory Examples</a></span></dt>
59<dt><span class="section"><a href="lambda/using_library.html#lambda.parameter_and_return_types">Parameter and return types of lambda functors</a></span></dt>
60<dt><span class="section"><a href="lambda/using_library.html#lambda.actual_arguments_to_lambda_functors">About actual arguments to lambda functors</a></span></dt>
61<dt><span class="section"><a href="lambda/using_library.html#lambda.storing_bound_arguments">Storing bound arguments in lambda functions</a></span></dt>
62</dl></dd>
63<dt><span class="section"><a href="lambda/le_in_details.html">Lambda expressions in details</a></span></dt>
64<dd><dl>
65<dt><span class="section"><a href="lambda/le_in_details.html#lambda.placeholders">Placeholders</a></span></dt>
66<dt><span class="section"><a href="lambda/le_in_details.html#lambda.operator_expressions">Operator expressions</a></span></dt>
67<dt><span class="section"><a href="lambda/le_in_details.html#lambda.bind_expressions">Bind expressions</a></span></dt>
68<dt><span class="section"><a href="lambda/le_in_details.html#lambda.overriding_deduced_return_type">Overriding the deduced return type</a></span></dt>
69<dt><span class="section"><a href="lambda/le_in_details.html#lambda.delaying_constants_and_variables">Delaying constants and variables</a></span></dt>
70<dt><span class="section"><a href="lambda/le_in_details.html#lambda.lambda_expressions_for_control_structures">Lambda expressions for control structures</a></span></dt>
71<dt><span class="section"><a href="lambda/le_in_details.html#lambda.exceptions">Exceptions</a></span></dt>
72<dt><span class="section"><a href="lambda/le_in_details.html#lambda.construction_and_destruction">Construction and destruction</a></span></dt>
73<dt><span class="section"><a href="lambda/le_in_details.html#id2711160">Special lambda expressions</a></span></dt>
74<dt><span class="section"><a href="lambda/le_in_details.html#id2711604">Casts, sizeof and typeid</a></span></dt>
75<dt><span class="section"><a href="lambda/le_in_details.html#lambda.nested_stl_algorithms">Nesting STL algorithm invocations</a></span></dt>
76</dl></dd>
77<dt><span class="section"><a href="lambda/extending.html">Extending return type deduction system</a></span></dt>
78<dt><span class="section"><a href="lambda/s07.html">Practical considerations</a></span></dt>
79<dd><dl>
80<dt><span class="section"><a href="lambda/s07.html#id2712759">Performance</a></span></dt>
81<dt><span class="section"><a href="lambda/s07.html#id2713087">About compiling</a></span></dt>
82<dt><span class="section"><a href="lambda/s07.html#id2713129">Portability</a></span></dt>
83</dl></dd>
84<dt><span class="section"><a href="lambda/s08.html">Relation to other Boost libraries</a></span></dt>
85<dd><dl>
86<dt><span class="section"><a href="lambda/s08.html#id2713388">Boost Function</a></span></dt>
87<dt><span class="section"><a href="lambda/s08.html#id2713474">Boost Bind</a></span></dt>
88</dl></dd>
89<dt><span class="section"><a href="lambda/s09.html">Contributors</a></span></dt>
90<dt><span class="appendix"><a href="apa.html">A. Rationale for some of the design decisions</a></span></dt>
91<dd><dl><dt><span class="section"><a href="apa.html#lambda.why_weak_arity">
92Lambda functor arity
93</a></span></dt></dl></dd>
94<dt><span class="bibliography"><a href="lambda.html#id2713747">Bibliography</a></span></dt>
95</dl>
96</div>
97<div class="section" lang="en">
98<div class="titlepage"><div><div><h3 class="title">
99<a name="introduction"></a>In a nutshell</h3></div></div></div>
100<p>
101
102      The Boost Lambda Library (BLL in the sequel) is a C++ template
103      library, which implements form of <span class="emphasis"><em>lambda abstractions</em></span> for C++.
104The term originates from functional programming and lambda calculus, where a lambda abstraction defines an unnamed function.
105      The primary motivation for the BLL is to provide flexible and
106      convenient means to define unnamed function objects for STL algorithms.
107In explaining what the library is about, a line of code says more than a thousand words; the
108      following line outputs the elements of some STL container
109      <code class="literal">a</code> separated by spaces:
110
111      </p>
112<pre class="programlisting">for_each(a.begin(), a.end(), std::cout &lt;&lt; _1 &lt;&lt; ' ');</pre>
113<p>
114
115      The expression <code class="literal">std::cout &lt;&lt; _1 &lt;&lt; ' '</code> defines a unary function object.
116      The variable <code class="literal">_1</code> is the parameter of this function, a <span class="emphasis"><em>placeholder</em></span> for the actual argument.
117      Within each iteration of <code class="literal">for_each</code>, the function is
118      called with an element of <code class="literal">a</code> as the actual argument.
119      This actual argument is substituted for the placeholder, and the &#8220;<span class="quote">body</span>&#8221; of the function is evaluated.
120    </p>
121<p>The essence of BLL is letting you define small unnamed function objects, such as the one above, directly on the call site of an STL algorithm.
122    </p>
123</div>
124<div class="bibliography">
125<div class="titlepage"><div><div><h2 class="title">
126<a name="id2713747"></a>Bibliography</h2></div></div></div>
127<div class="biblioentry">
128<a name="cit:stepanov:94"></a><p>[<span class="abbrev">STL94</span>] <span class="authorgroup"><span class="firstname">A. A.</span> <span class="surname">Stepanov</span> and <span class="firstname">M.</span> <span class="surname">Lee</span>. </span><span class="title"><i>The Standard Template Library</i>. </span><span class="orgname">Hewlett-Packard Laboratories. </span><span class="pubdate">1994. </span><span class="bibliomisc"><a href="http://www.hpl.hp.com/techreports" target="_top">www.hpl.hp.com/techreports</a>. </span></p>
129</div>
130<div class="biblioentry">
131<a name="cit:sgi:02"></a><p>[<span class="abbrev">SGI02</span>] <span class="title"><i>The SGI Standard Template Library</i>. </span><span class="pubdate">2002. </span><span class="bibliomisc"><a href="http://www.sgi.com/tech/stl/" target="_top">www.sgi.com/tech/stl/</a>. </span></p>
132</div>
133<div class="biblioentry">
134<a name="cit:c++:98"></a><p>[<span class="abbrev">C++98</span>] <span class="title"><i>International Standard, Programming Languages &#8211; C++</i>. </span><span class="subtitle">ISO/IEC:14882. </span><span class="pubdate">1998. </span></p>
135</div>
136<div class="biblioentry">
137<a name="cit:jarvi:99"></a><p>[<span class="abbrev">Jär99</span>] <span class="articleinfo"><span class="author"><span class="firstname">Jaakko</span> <span class="surname">Järvi</span>. </span><span class="title"><i>C++ Function Object Binders Made Easy</i>. </span>. </span><span class="title"><i>Lecture Notes in Computer Science</i>. </span><span class="volumenum">1977. </span><span class="publishername">Springer. </span><span class="pubdate">2000. </span></p>
138</div>
139<div class="biblioentry">
140<a name="cit:jarvi:00"></a><p>[<span class="abbrev">Jär00</span>] <span class="author"><span class="firstname">Jaakko</span> <span class="surname">Järvi</span>. </span><span class="author"><span class="firstname">Gary</span> <span class="surname">Powell</span>. </span><span class="title"><i>The Lambda Library : Lambda Abstraction in C++</i>. </span><span class="orgname">Turku Centre for Computer Science. </span><span class="bibliomisc">Technical Report . </span><span class="issuenum">378. </span><span class="pubdate">2000. </span><span class="bibliomisc"><a href="http://www.tucs.fi/Publications/techreports/TR378.php" target="_top">www.tucs.fi/publications</a>. </span></p>
141</div>
142<div class="biblioentry">
143<a name="cit:jarvi:01"></a><p>[<span class="abbrev">Jär01</span>] <span class="author"><span class="firstname">Jaakko</span> <span class="surname">Järvi</span>. </span><span class="author"><span class="firstname">Gary</span> <span class="surname">Powell</span>. </span><span class="title"><i>The Lambda Library : Lambda Abstraction in C++</i>. </span><span class="confgroup"><span class="conftitle">Second  Workshop on C++ Template Programming. </span><span class="address">Tampa Bay, OOPSLA'01. </span>. </span><span class="pubdate">2001. </span><span class="bibliomisc"><a href="http://www.oonumerics.org/tmpw01/" target="_top">www.oonumerics.org/tmpw01/</a>. </span></p>
144</div>
145<div class="biblioentry">
146<a name="cit:jarvi:03"></a><p>[<span class="abbrev">Jär03</span>] <span class="articleinfo"><span class="author"><span class="firstname">Jaakko</span> <span class="surname">Järvi</span>. </span><span class="author"><span class="firstname">Gary</span> <span class="surname">Powell</span>. </span><span class="author"><span class="firstname">Andrew</span> <span class="surname">Lumsdaine</span>. </span><span class="title"><i>The Lambda Library : unnamed functions in C++</i>. </span>. </span><span class="title"><i>Software - Practice and Expreience</i>. </span><span class="volumenum">33:259-291. </span><span class="pubdate">2003. </span></p>
147</div>
148<div class="biblioentry">
149<a name="cit:boost::tuple"></a><p>[<span class="abbrev">tuple</span>] <span class="title"><i>The Boost Tuple Library</i>. </span><span class="bibliomisc"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html" target="_top">www.boost.org/libs/tuple/doc/tuple_users_guide.html</a>. </span><span class="pubdate">2002. </span></p>
150</div>
151<div class="biblioentry">
152<a name="cit:boost::type_traits"></a><p>[<span class="abbrev">type_traits</span>] <span class="title"><i>The Boost type_traits</i>. </span><span class="bibliomisc"><a href="http://www.boost.org/libs/type_traits/index.htm" target="_top">www.boost.org/libs/type_traits/</a>. </span><span class="pubdate">2002. </span></p>
153</div>
154<div class="biblioentry">
155<a name="cit:boost::ref"></a><p>[<span class="abbrev">ref</span>] <span class="title"><i>Boost ref</i>. </span><span class="bibliomisc"><a href="http://www.boost.org/libs/bind/ref.html" target="_top">www.boost.org/libs/bind/ref.html</a>. </span><span class="pubdate">2002. </span></p>
156</div>
157<div class="biblioentry">
158<a name="cit:boost::bind"></a><p>[<span class="abbrev">bind</span>] <span class="title"><i>Boost Bind Library</i>. </span><span class="bibliomisc"><a href="http://www.boost.org/libs/bind/bind.html" target="_top">www.boost.org/libs/bind/bind.html</a>. </span><span class="pubdate">2002. </span></p>
159</div>
160<div class="biblioentry">
161<a name="cit:boost::function"></a><p>[<span class="abbrev">function</span>] <span class="title"><i>Boost Function Library</i>. </span><span class="bibliomisc"><a href="http://www.boost.org/libs/function/" target="_top">www.boost.org/libs/function/</a>. </span><span class="pubdate">2002. </span></p>
162</div>
163<div class="biblioentry">
164<a name="cit:fc++"></a><p>[<span class="abbrev">fc++</span>] <span class="title"><i>The FC++ library: Functional Programming in C++</i>. </span><span class="author"><span class="firstname">Yannis</span> <span class="surname">Smaragdakis</span>. </span><span class="author"><span class="firstname">Brian</span> <span class="surname">McNamara</span>. </span><span class="bibliomisc"><a href="http://www.cc.gatech.edu/~yannis/fc++/" target="_top">www.cc.gatech.edu/~yannis/fc++/</a>. </span><span class="pubdate">2002. </span></p>
165</div>
166</div>
167</div>
168<table width="100%"><tr>
169<td align="left"><small><p>Last revised: November 28, 2004 at 03:29:16 GMT</p></small></td>
170<td align="right"><small></small></td>
171</tr></table>
172<hr>
173<div class="spirit-nav">
174<a accesskey="p" href="hash/acknowledgements.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="lambda/getting_started.html"><img src="images/next.png" alt="Next"></a>
175</div>
176</body>
177</html>
Note: See TracBrowser for help on using the repository browser.