File: compose.html

package info (click to toggle)
boost 1.27.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 19,908 kB
  • ctags: 26,546
  • sloc: cpp: 122,225; ansic: 10,956; python: 4,412; sh: 855; yacc: 803; makefile: 257; perl: 165; lex: 90; csh: 6
file content (152 lines) | stat: -rw-r--r-- 5,642 bytes parent folder | download
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="keywords" content="Josuttis, C++, countedptr, counted reference, smart pointer, Code, examples, Beispiele, objektorientiert, Informatik, Nicolai Josuttis, Nicolai M. Josuttis">
   <meta name="GENERATOR" content="Mozilla/4.51 [en] (X11; I; Linux 2.2.5 i586) [Netscape]">
   <meta name="Keywords" content="compose1, compose2, compose_f_gx, compose_f_gxy, compose_f_gx_hx, compose_f_gx_hy, function object, adapter, adaptor, STL, C++ Standard Library">
   <title>Compose Function Object Adapters</title>
</head>
<body text="#000000" bgcolor="#FFFFFF">
&nbsp;
<table>
<tr>
    <td WIDTH="680" BGCOLOR="#DDDDDD"><b><font face="Arial,helvetica" color="#000000" size="+1">Compose 
      Function Object Adapters</font></b></td>
</tr>
</table>

<p><font face="Arial,Helvetica">The C++ Standard Template Library STL as
part of the C++ Standard Library provides several function objects. Unfortunately,
it doesn't provide the ability to compose these function objects. For example,
it is not possible to combine the result of two unary operations to formulate
a criterion such as ``<i>this <b>and</b> that'</i>'. But this would be
important for building software components out of other components, which
leads to the concept of functional composition. So, here are some adapters
that close this gap.</font>
<p><font face="Arial,Helvetica">In fact, these adapters provide to compose
function objects as follows:</font>
<br>&nbsp;
<table NOSAVE >
<tr NOSAVE>
<td NOSAVE><b><font face="Arial,Helvetica">Functionality</font></b></td>

<td><b><font face="Arial,Helvetica">Boost Name</font></b></td>

<td><b><font face="Arial,Helvetica">SGI STL's Name</font></b></td>
</tr>

<tr>
<td><font face="Times New Roman,Times">f(g(<i>value</i>))</font></td>

<td><font face="Times New Roman,Times">compose_f_gx</font></td>

<td><font face="Times New Roman,Times">compose1</font></td>
</tr>

<tr>
<td><font face="Times New Roman,Times">f(g(<i>value</i>),h(<i>value</i>))</font></td>

<td><font face="Times New Roman,Times">compose_f_gx_hx</font></td>

<td><font face="Times New Roman,Times">compose2</font></td>
</tr>

<tr>
<td><font face="Times New Roman,Times">f(g(<i>value1</i>),h(<i>value2</i>))</font></td>

<td><font face="Times New Roman,Times">compose_f_gx_hy</font></td>

<td></td>
</tr>

<tr>
<td><font face="Times New Roman,Times">f(g(<i>value1</i>,<i>value2</i>))</font></td>

<td><font face="Times New Roman,Times">compose_f_gxy</font></td>

<td></td>
</tr>

<tr>
<td><font face="Times New Roman,Times">f(g())</font></td>

<td><font face="Times New Roman,Times">compose_f_g</font></td>

<td></td>
</tr>
</table>

<p><font face="Arial,Helvetica">As you can see, two of these adapters are
part of the SGI STL already.
However, we changed the names according to
a consistent naming scheme for all adapters.</font>
<p><font face="Arial,Helvetica">In addition, this code also defines a type </font><tt>nullary_function</tt><font face="Arial,Helvetica"> 
  for function objects that have no argument (as supplement to </font><tt>unary_function</tt><font face="Arial,Helvetica"> 
  and </font><tt>binary_function</tt><font face="Arial,Helvetica">) and overloads 
  </font><tt>ptr_fun</tt><font face="Arial,Helvetica"> for functions that take 
  no arguments.</font> 
<p><font face="Arial,Helvetica">The code is provided "as is" without expressed 
  or implied warranty.</font> 
<p><b><font face="Arial,Helvetica">compose.hpp:</font></b>
<li>
<font face="Arial,Helvetica"><a href="compose.hpp.html">as HTML file</a></font></li>

<li> <font face="Arial,Helvetica"><a href="../../boost/compose.hpp">as plain file</a></font><br>
  <br>
  <font face="Arial,Helvetica">Example for using </font><b>compose_f_gx</b> </li>
<li>
<tt><a href="compose1.cpp.html">as HTML file</a></tt></li>

<li>
<tt><a href="compose1.cpp">as plain file</a></tt></li>

<br>
<font face="Arial,Helvetica">Example for using </font><b>compose_f_gx_hx</b> 
<li>
<tt><a href="compose2.cpp.html">as HTML file</a></tt></li>

<li>
<tt><a href="compose2.cpp">as plain file</a></tt></li>

<br><font face="Arial,Helvetica">Example for using
</font><b>compose_f_gx_hy</b>
<li>
<tt><a href="compose3.cpp.html">as HTML file</a></tt></li>

<li>
<tt><a href="compose3.cpp">as plain file</a></tt></li>

<br><font face="Arial,Helvetica">Example for using
</font><b>compose_f_g</b>
and <b><tt>ptr_fun</tt></b> for functions without arguments
<li>
<a href="compose4.cpp.html">as HTML file</a></li>

<li> <a href="compose4.cpp">as plain file<br>
  <br>
  </a><b>All files</b> </li>

<li>
<a href="compose.zip">as ZIP file</a></li>

<li> <a href="compose.tgz">as TGZ file<br>
  </a><br>
  <font face="Arial,Helvetica">To find more details about function objects in 
  general and about these compose functions, see</font> <br>
  <i><font face="Arial,Helvetica">&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.josuttis.com/libbook/">The 
  C++ Standard Library - A Tutorial and Reference</a></font></i> <br>
  <font face="Arial,Helvetica">&nbsp;&nbsp;&nbsp;&nbsp; by Nicolai M. Josuttis</font> 
  <br>
  <font face="Arial,Helvetica">&nbsp;&nbsp;&nbsp;&nbsp; Addison Wesley Longman, 
  1999</font> <br>
  <font face="Arial,Helvetica">&nbsp;&nbsp;&nbsp;&nbsp; ISBN 0-201-37926-0</font> 
  <br>
  <font face="Arial,Helvetica">and the <a href="http://www.sgi.com/Technology/STL/">SGI 
  STL documentation</a></font> </li>

<p><font face="Arial,Helvetica"><a href="http://www.josuttis.com/" TARGET="_top">Home
Page</a></font>
<br>&nbsp;
</body>
</html>