mirror of
https://github.com/boostorg/compose.git
synced 2026-01-19 04:02:16 +00:00
153 lines
5.5 KiB
HTML
153 lines
5.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">
|
|
<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">
|
|
|
|
<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>
|
|
<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"> <a href="http://www.josuttis.com/libbook/">The
|
|
C++ Standard Library - A Tutorial and Reference</a></font></i> <br>
|
|
<font face="Arial,Helvetica"> by Nicolai M. Josuttis</font>
|
|
<br>
|
|
<font face="Arial,Helvetica"> Addison Wesley Longman,
|
|
1999</font> <br>
|
|
<font face="Arial,Helvetica"> 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>
|
|
</body>
|
|
</html>
|