2
0
mirror of https://github.com/boostorg/compose.git synced 2026-01-19 04:02:16 +00:00

This commit was manufactured by cvs2svn to create tag

'perforce_2_4_merge_1'.

[SVN r13112]
This commit is contained in:
nobody
2002-03-06 14:13:30 +00:00
parent becadf3a9e
commit 03f4b22642
13 changed files with 0 additions and 1109 deletions

View File

@@ -1,459 +0,0 @@
<HTML>
<HEAD>
<TITLE>compose.hpp</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF">
&nbsp;
<TABLE HEIGHT=40 WIDTH="100%">
<TR> <TD ALIGN=LEFT WIDTH="100%" BGCOLOR="#DDDDDD">
<FONT face="Arial,Helvetica" size=+2><B>
&nbsp;compose.hpp
</B></FONT>
</TD></TR></TABLE><BR>
<FONT face="Arial,Helvetica"><B>
The following code example is taken from the book<BR>
<A HREF="http://www.josuttis.com/libbook/" TARGET="_top">
The C++ Standard Library - A Tutorial and Reference</A><BR>
by Nicolai M. Josuttis, Addison-Wesley, 1999<BR>
<A HREF="http://www.josuttis.com/libbook/copyright.html">
&copy; Copyright</A> Nicolai M. Josuttis 1999<BR>
</B></FONT>
<BR><BR><TT>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;supplementing&nbsp;compose&nbsp;function&nbsp;objects</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;Son&nbsp;Dez&nbsp;26&nbsp;22:11:12&nbsp;MET&nbsp;1999</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
#ifndef&nbsp;BOOST_COMPOSE_HPP<BR>
#define&nbsp;BOOST_COMPOSE_HPP<BR>
<BR>
#include&nbsp;&lt;functional&gt;<BR>
<BR>
namespace&nbsp;boost&nbsp;{<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>**********************************************************</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;type&nbsp;nullary_function</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;-&nbsp;as&nbsp;supplement&nbsp;to&nbsp;unary_function&nbsp;and&nbsp;binary_function</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>**********************************************************/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;Result&gt;<BR>
struct&nbsp;nullary_function&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;typedef&nbsp;Result&nbsp;result_type;<BR>
};<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>**********************************************************</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;ptr_fun&nbsp;for&nbsp;functions&nbsp;with&nbsp;no&nbsp;argument</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>**********************************************************/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;Result&gt;<BR>
class&nbsp;pointer_to_nullary_function&nbsp;:&nbsp;public&nbsp;nullary_function&lt;Result&gt;<BR>
{<BR>
&nbsp;&nbsp;protected:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;Result&nbsp;(*ptr)();<BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;pointer_to_nullary_function()&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;explicit&nbsp;pointer_to_nullary_function(Result&nbsp;(*x)())&nbsp;:&nbsp;ptr(x)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;Result&nbsp;operator()()&nbsp;const&nbsp;{&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;ptr();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
};<BR>
<BR>
template&nbsp;&lt;class&nbsp;Result&gt;<BR>
inline&nbsp;pointer_to_nullary_function&lt;Result&gt;&nbsp;ptr_fun(Result&nbsp;(*x)())<BR>
{<BR>
&nbsp;&nbsp;return&nbsp;pointer_to_nullary_function&lt;Result&gt;(x);<BR>
}<BR>
<BR>
<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>***********&nbsp;compose_f_gx_t&nbsp;and&nbsp;compose_f_gx&nbsp;**********************/</I></FONT></I></FONT><BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;class&nbsp;for&nbsp;the&nbsp;compose_f_gx&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2&gt;<BR>
class&nbsp;compose_f_gx_t<BR>
&nbsp;:&nbsp;public&nbsp;std::unary_function&lt;typename&nbsp;OP2::argument_type,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type&gt;<BR>
{<BR>
&nbsp;&nbsp;private:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP1&nbsp;op1;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;process:&nbsp;op1(op2(x))</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP2&nbsp;op2;<BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;constructor</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;compose_f_gx_t(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;op1(o1),&nbsp;op2(o2)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;function&nbsp;call</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type<BR>
&nbsp;&nbsp;&nbsp;&nbsp;operator()(const&nbsp;typename&nbsp;OP2::argument_type&&nbsp;x)&nbsp;const&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;op1(op2(x));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
};<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;convenience&nbsp;functions&nbsp;for&nbsp;the&nbsp;compose_f_gx&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2&gt;<BR>
inline&nbsp;compose_f_gx_t&lt;OP1,OP2&gt;<BR>
compose_f_gx&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;compose_f_gx_t&lt;OP1,OP2&gt;(o1,o2);<BR>
}<BR>
<BR>
<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>***********&nbsp;compose_f_gx_hx_t&nbsp;and&nbsp;compose_f_gx_hx&nbsp;**********************/</I></FONT></I></FONT><BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;class&nbsp;for&nbsp;the&nbsp;compose_f_gx_hx&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2,&nbsp;class&nbsp;OP3&gt;<BR>
class&nbsp;compose_f_gx_hx_t<BR>
&nbsp;:&nbsp;public&nbsp;std::unary_function&lt;typename&nbsp;OP2::argument_type,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type&gt;<BR>
{<BR>
&nbsp;&nbsp;private:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP1&nbsp;op1;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;process:&nbsp;op1(op2(x),op3(x))</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP2&nbsp;op2;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP3&nbsp;op3;<BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;constructor</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;compose_f_gx_hx_t&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2,&nbsp;const&nbsp;OP3&&nbsp;o3)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;op1(o1),&nbsp;op2(o2),&nbsp;op3(o3)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;function&nbsp;call</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type<BR>
&nbsp;&nbsp;&nbsp;&nbsp;operator()(const&nbsp;typename&nbsp;OP2::argument_type&&nbsp;x)&nbsp;const&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;op1(op2(x),op3(x));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
};<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;convenience&nbsp;functions&nbsp;for&nbsp;the&nbsp;compose_f_gx_hx&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2,&nbsp;class&nbsp;OP3&gt;<BR>
inline&nbsp;compose_f_gx_hx_t&lt;OP1,OP2,OP3&gt;<BR>
compose_f_gx_hx&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2,&nbsp;const&nbsp;OP3&&nbsp;o3)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;compose_f_gx_hx_t&lt;OP1,OP2,OP3&gt;(o1,o2,o3);<BR>
}<BR>
<BR>
<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>***********&nbsp;compose_f_gxy_t&nbsp;and&nbsp;compose_f_gxy&nbsp;**********************/</I></FONT></I></FONT><BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;class&nbsp;for&nbsp;the&nbsp;compose_f_gxy&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2&gt;<BR>
class&nbsp;compose_f_gxy_t<BR>
&nbsp;:&nbsp;public&nbsp;std::binary_function&lt;typename&nbsp;OP2::first_argument_type,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP2::second_argument_type,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type&gt;<BR>
{<BR>
&nbsp;&nbsp;private:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP1&nbsp;op1;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;process:&nbsp;op1(op2(x,y))</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP2&nbsp;op2;<BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;constructor</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;compose_f_gxy_t&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;op1(o1),&nbsp;op2(o2)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;function&nbsp;call</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type<BR>
&nbsp;&nbsp;&nbsp;&nbsp;operator()(const&nbsp;typename&nbsp;OP2::first_argument_type&&nbsp;x,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;typename&nbsp;OP2::second_argument_type&&nbsp;y)&nbsp;const&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;op1(op2(x,y));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
};<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;convenience&nbsp;function&nbsp;for&nbsp;the&nbsp;compose_f_gxy&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2&gt;<BR>
inline&nbsp;compose_f_gxy_t&lt;OP1,OP2&gt;<BR>
compose_f_gxy&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;compose_f_gxy_t&lt;OP1,OP2&gt;(o1,o2);<BR>
}<BR>
<BR>
<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>***********&nbsp;compose_f_gx_hy_t&nbsp;and&nbsp;compose_f_gx_hy&nbsp;**********************/</I></FONT></I></FONT><BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;class&nbsp;for&nbsp;the&nbsp;compose_f_gx_hy&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2,&nbsp;class&nbsp;OP3&gt;<BR>
class&nbsp;compose_f_gx_hy_t<BR>
&nbsp;:&nbsp;public&nbsp;std::binary_function&lt;typename&nbsp;OP2::argument_type,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP3::argument_type,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type&gt;<BR>
{<BR>
&nbsp;&nbsp;private:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP1&nbsp;op1;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;process:&nbsp;op1(op2(x),op3(y))</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP2&nbsp;op2;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP3&nbsp;op3;<BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;constructor</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;compose_f_gx_hy_t&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2,&nbsp;const&nbsp;OP3&&nbsp;o3)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;op1(o1),&nbsp;op2(o2),&nbsp;op3(o3)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;function&nbsp;call</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type<BR>
&nbsp;&nbsp;&nbsp;&nbsp;operator()(const&nbsp;typename&nbsp;OP2::argument_type&&nbsp;x,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;typename&nbsp;OP3::argument_type&&nbsp;y)&nbsp;const&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;op1(op2(x),op3(y));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
};<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;convenience&nbsp;function&nbsp;for&nbsp;the&nbsp;compose_f_gx_hy&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2,&nbsp;class&nbsp;OP3&gt;<BR>
inline&nbsp;compose_f_gx_hy_t&lt;OP1,OP2,OP3&gt;<BR>
compose_f_gx_hy&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2,&nbsp;const&nbsp;OP3&&nbsp;o3)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;compose_f_gx_hy_t&lt;OP1,OP2,OP3&gt;(o1,o2,o3);<BR>
}<BR>
<BR>
<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>***********&nbsp;compose_f_g_t&nbsp;and&nbsp;compose_f_g&nbsp;**********************/</I></FONT></I></FONT><BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;class&nbsp;for&nbsp;the&nbsp;compose_f_g&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2&gt;<BR>
class&nbsp;compose_f_g_t<BR>
&nbsp;:&nbsp;public&nbsp;boost::nullary_function&lt;typename&nbsp;OP1::result_type&gt;<BR>
{<BR>
&nbsp;&nbsp;private:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP1&nbsp;op1;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;process:&nbsp;op1(op2())</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP2&nbsp;op2;<BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;constructor</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;compose_f_g_t(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;op1(o1),&nbsp;op2(o2)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;function&nbsp;call</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type<BR>
&nbsp;&nbsp;&nbsp;&nbsp;operator()()&nbsp;const&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;op1(op2());<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
};<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;convenience&nbsp;functions&nbsp;for&nbsp;the&nbsp;compose_f_g&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2&gt;<BR>
inline&nbsp;compose_f_g_t&lt;OP1,OP2&gt;<BR>
compose_f_g&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;compose_f_g_t&lt;OP1,OP2&gt;(o1,o2);<BR>
}<BR>
<BR>
}&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;namespace&nbsp;boost&nbsp;*/</I></FONT></I></FONT><BR>
<BR>
#endif&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*BOOST_COMPOSE_HPP*/</I></FONT></I></FONT><BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;supplementing&nbsp;compose&nbsp;function&nbsp;objects</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;Son&nbsp;Dez&nbsp;26&nbsp;22:14:55&nbsp;MET&nbsp;1999</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
#ifndef&nbsp;BOOST_COMPOSE_HPP<BR>
#define&nbsp;BOOST_COMPOSE_HPP<BR>
<BR>
#include&nbsp;&lt;functional&gt;<BR>
<BR>
namespace&nbsp;boost&nbsp;{<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>**********************************************************</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;type&nbsp;nullary_function</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;-&nbsp;as&nbsp;supplement&nbsp;to&nbsp;unary_function&nbsp;and&nbsp;binary_function</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>**********************************************************/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;Result&gt;<BR>
struct&nbsp;nullary_function&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;typedef&nbsp;Result&nbsp;result_type;<BR>
};<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>**********************************************************</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;ptr_fun&nbsp;for&nbsp;functions&nbsp;with&nbsp;no&nbsp;argument</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>**********************************************************/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;Result&gt;<BR>
class&nbsp;pointer_to_nullary_function&nbsp;:&nbsp;public&nbsp;nullary_function&lt;Result&gt;<BR>
{<BR>
&nbsp;&nbsp;protected:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;Result&nbsp;(*ptr)();<BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;pointer_to_nullary_function()&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;explicit&nbsp;pointer_to_nullary_function(Result&nbsp;(*x)())&nbsp;:&nbsp;ptr(x)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;Result&nbsp;operator()()&nbsp;const&nbsp;{&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;ptr();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
};<BR>
<BR>
template&nbsp;&lt;class&nbsp;Result&gt;<BR>
inline&nbsp;pointer_to_nullary_function&lt;Result&gt;&nbsp;ptr_fun(Result&nbsp;(*x)())<BR>
{<BR>
&nbsp;&nbsp;return&nbsp;pointer_to_nullary_function&lt;Result&gt;(x);<BR>
}<BR>
<BR>
<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>***********&nbsp;compose_f_gx_t&nbsp;and&nbsp;compose_f_gx&nbsp;**********************/</I></FONT></I></FONT><BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;class&nbsp;for&nbsp;the&nbsp;compose_f_gx&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2&gt;<BR>
class&nbsp;compose_f_gx_t<BR>
&nbsp;:&nbsp;public&nbsp;std::unary_function&lt;typename&nbsp;OP2::argument_type,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type&gt;<BR>
{<BR>
&nbsp;&nbsp;private:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP1&nbsp;op1;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;process:&nbsp;op1(op2(x))</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP2&nbsp;op2;<BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;constructor</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;compose_f_gx_t(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;op1(o1),&nbsp;op2(o2)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;function&nbsp;call</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type<BR>
&nbsp;&nbsp;&nbsp;&nbsp;operator()(const&nbsp;typename&nbsp;OP2::argument_type&&nbsp;x)&nbsp;const&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;op1(op2(x));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
};<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;convenience&nbsp;functions&nbsp;for&nbsp;the&nbsp;compose_f_gx&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2&gt;<BR>
inline&nbsp;compose_f_gx_t&lt;OP1,OP2&gt;<BR>
compose_f_gx&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;compose_f_gx_t&lt;OP1,OP2&gt;(o1,o2);<BR>
}<BR>
<BR>
<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>***********&nbsp;compose_f_gx_hx_t&nbsp;and&nbsp;compose_f_gx_hx&nbsp;**********************/</I></FONT></I></FONT><BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;class&nbsp;for&nbsp;the&nbsp;compose_f_gx_hx&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2,&nbsp;class&nbsp;OP3&gt;<BR>
class&nbsp;compose_f_gx_hx_t<BR>
&nbsp;:&nbsp;public&nbsp;std::unary_function&lt;typename&nbsp;OP2::argument_type,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type&gt;<BR>
{<BR>
&nbsp;&nbsp;private:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP1&nbsp;op1;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;process:&nbsp;op1(op2(x),op3(x))</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP2&nbsp;op2;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP3&nbsp;op3;<BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;constructor</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;compose_f_gx_hx_t&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2,&nbsp;const&nbsp;OP3&&nbsp;o3)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;op1(o1),&nbsp;op2(o2),&nbsp;op3(o3)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;function&nbsp;call</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type<BR>
&nbsp;&nbsp;&nbsp;&nbsp;operator()(const&nbsp;typename&nbsp;OP2::argument_type&&nbsp;x)&nbsp;const&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;op1(op2(x),op3(x));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
};<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;convenience&nbsp;functions&nbsp;for&nbsp;the&nbsp;compose_f_gx_hx&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2,&nbsp;class&nbsp;OP3&gt;<BR>
inline&nbsp;compose_f_gx_hx_t&lt;OP1,OP2,OP3&gt;<BR>
compose_f_gx_hx&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2,&nbsp;const&nbsp;OP3&&nbsp;o3)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;compose_f_gx_hx_t&lt;OP1,OP2,OP3&gt;(o1,o2,o3);<BR>
}<BR>
<BR>
<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>***********&nbsp;compose_f_gxy_t&nbsp;and&nbsp;compose_f_gxy&nbsp;**********************/</I></FONT></I></FONT><BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;class&nbsp;for&nbsp;the&nbsp;compose_f_gxy&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2&gt;<BR>
class&nbsp;compose_f_gxy_t<BR>
&nbsp;:&nbsp;public&nbsp;std::binary_function&lt;typename&nbsp;OP2::first_argument_type,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP2::second_argument_type,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type&gt;<BR>
{<BR>
&nbsp;&nbsp;private:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP1&nbsp;op1;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;process:&nbsp;op1(op2(x,y))</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP2&nbsp;op2;<BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;constructor</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;compose_f_gxy_t&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;op1(o1),&nbsp;op2(o2)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;function&nbsp;call</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type<BR>
&nbsp;&nbsp;&nbsp;&nbsp;operator()(const&nbsp;typename&nbsp;OP2::first_argument_type&&nbsp;x,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;typename&nbsp;OP2::second_argument_type&&nbsp;y)&nbsp;const&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;op1(op2(x,y));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
};<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;convenience&nbsp;function&nbsp;for&nbsp;the&nbsp;compose_f_gxy&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2&gt;<BR>
inline&nbsp;compose_f_gxy_t&lt;OP1,OP2&gt;<BR>
compose_f_gxy&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;compose_f_gxy_t&lt;OP1,OP2&gt;(o1,o2);<BR>
}<BR>
<BR>
<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>***********&nbsp;compose_f_gx_hy_t&nbsp;and&nbsp;compose_f_gx_hy&nbsp;**********************/</I></FONT></I></FONT><BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;class&nbsp;for&nbsp;the&nbsp;compose_f_gx_hy&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2,&nbsp;class&nbsp;OP3&gt;<BR>
class&nbsp;compose_f_gx_hy_t<BR>
&nbsp;:&nbsp;public&nbsp;std::binary_function&lt;typename&nbsp;OP2::argument_type,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP3::argument_type,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type&gt;<BR>
{<BR>
&nbsp;&nbsp;private:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP1&nbsp;op1;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;process:&nbsp;op1(op2(x),op3(y))</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP2&nbsp;op2;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP3&nbsp;op3;<BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;constructor</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;compose_f_gx_hy_t&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2,&nbsp;const&nbsp;OP3&&nbsp;o3)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;op1(o1),&nbsp;op2(o2),&nbsp;op3(o3)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;function&nbsp;call</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type<BR>
&nbsp;&nbsp;&nbsp;&nbsp;operator()(const&nbsp;typename&nbsp;OP2::argument_type&&nbsp;x,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;typename&nbsp;OP3::argument_type&&nbsp;y)&nbsp;const&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;op1(op2(x),op3(y));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
};<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;convenience&nbsp;function&nbsp;for&nbsp;the&nbsp;compose_f_gx_hy&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2,&nbsp;class&nbsp;OP3&gt;<BR>
inline&nbsp;compose_f_gx_hy_t&lt;OP1,OP2,OP3&gt;<BR>
compose_f_gx_hy&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2,&nbsp;const&nbsp;OP3&&nbsp;o3)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;compose_f_gx_hy_t&lt;OP1,OP2,OP3&gt;(o1,o2,o3);<BR>
}<BR>
<BR>
<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>***********&nbsp;compose_f_g_t&nbsp;and&nbsp;compose_f_g&nbsp;**********************/</I></FONT></I></FONT><BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;class&nbsp;for&nbsp;the&nbsp;compose_f_g&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2&gt;<BR>
class&nbsp;compose_f_g_t<BR>
&nbsp;:&nbsp;public&nbsp;boost::nullary_function&lt;typename&nbsp;OP1::result_type&gt;<BR>
{<BR>
&nbsp;&nbsp;private:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP1&nbsp;op1;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;process:&nbsp;op1(op2())</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;OP2&nbsp;op2;<BR>
&nbsp;&nbsp;public:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;constructor</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;compose_f_g_t(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;op1(o1),&nbsp;op2(o2)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;function&nbsp;call</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;OP1::result_type<BR>
&nbsp;&nbsp;&nbsp;&nbsp;operator()()&nbsp;const&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;op1(op2());<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
};<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;convenience&nbsp;functions&nbsp;for&nbsp;the&nbsp;compose_f_g&nbsp;adapter</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;OP1,&nbsp;class&nbsp;OP2&gt;<BR>
inline&nbsp;compose_f_g_t&lt;OP1,OP2&gt;<BR>
compose_f_g&nbsp;(const&nbsp;OP1&&nbsp;o1,&nbsp;const&nbsp;OP2&&nbsp;o2)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;compose_f_g_t&lt;OP1,OP2&gt;(o1,o2);<BR>
}<BR>
<BR>
}&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;namespace&nbsp;boost&nbsp;*/</I></FONT></I></FONT><BR>
<BR>
#endif&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1><Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*BOOST_COMPOSE_HPP*/</I></FONT></I></FONT><BR>
</TT>
</BODY>
</HTML>

View File

@@ -1,152 +0,0 @@
<!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>

View File

@@ -1,38 +0,0 @@
/* The following code example is taken from the book
* "The C++ Standard Library - A Tutorial and Reference"
* by Nicolai M. Josuttis, Addison-Wesley, 1999
*
* (C) Copyright Nicolai M. Josuttis 1999.
* Permission to copy, use, modify, sell and distribute this software
* is granted provided this copyright notice appears in all copies.
* This software is provided "as is" without express or implied
* warranty, and with no claim as to its suitability for any purpose.
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <iterator>
#include "print.hpp"
#include <boost/compose.hpp>
using namespace std;
using namespace boost;
int main()
{
vector<int> coll;
// insert elements from 1 to 9
for (int i=1; i<=9; ++i) {
coll.push_back(i);
}
PRINT_ELEMENTS(coll);
// for each element add 10 and multiply by 5
transform (coll.begin(),coll.end(),
ostream_iterator<int>(cout," "),
compose_f_gx(bind2nd(multiplies<int>(),5),
bind2nd(plus<int>(),10)));
cout << endl;
}

View File

@@ -1,54 +0,0 @@
<HTML>
<HEAD>
<TITLE>compose1.cpp</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF">
&nbsp;
<TABLE HEIGHT=40 WIDTH="100%">
<TR> <TD ALIGN=LEFT WIDTH="100%" BGCOLOR="#DDDDDD">
<FONT face="Arial,Helvetica" size=+2><B>
&nbsp;compose1.cpp
</B></FONT>
</TD></TR></TABLE><BR>
<FONT face="Arial,Helvetica"><B>
The following code example is taken from the book<BR>
<A HREF="http://www.josuttis.com/libbook/" TARGET="_top">
The C++ Standard Library - A Tutorial and Reference</A><BR>
by Nicolai M. Josuttis, Addison-Wesley, 1999<BR>
<A HREF="http://www.josuttis.com/libbook/copyright.html">
&copy; Copyright</A> Nicolai M. Josuttis 1999<BR>
</B></FONT>
<BR><BR><TT>
#include&nbsp;&lt;iostream&gt;<BR>
#include&nbsp;&lt;vector&gt;<BR>
#include&nbsp;&lt;algorithm&gt;<BR>
#include&nbsp;&lt;functional&gt;<BR>
#include&nbsp;&lt;iterator&gt;<BR>
#include&nbsp;"<A href="print.hpp.html">print.hpp</A>"<BR>
#include&nbsp;"<A href="compose.hpp.html">compose.hpp</A>"<BR>
using&nbsp;namespace&nbsp;std;<BR>
using&nbsp;namespace&nbsp;boost;<BR>
<BR>
int&nbsp;main()<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vector&lt;int&gt;&nbsp;coll;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;insert&nbsp;elements&nbsp;from&nbsp;1&nbsp;to&nbsp;9</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(int&nbsp;i=1;&nbsp;i&lt;=9;&nbsp;++i)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;coll.push_back(i);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;PRINT_ELEMENTS(coll);<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;for&nbsp;each&nbsp;element&nbsp;add&nbsp;10&nbsp;and&nbsp;multiply&nbsp;by&nbsp;5</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;transform&nbsp;(coll.begin(),coll.end(),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ostream_iterator&lt;int&gt;(cout,"&nbsp;"),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;compose_f_gx(bind2nd(multiplies&lt;int&gt;(),5),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bind2nd(plus&lt;int&gt;(),10)));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;&lt;&lt;&nbsp;endl;<BR>
}<BR>
</TT>
</BODY>
</HTML>

View File

@@ -1,42 +0,0 @@
/* The following code example is taken from the book
* "The C++ Standard Library - A Tutorial and Reference"
* by Nicolai M. Josuttis, Addison-Wesley, 1999
*
* (C) Copyright Nicolai M. Josuttis 1999.
* Permission to copy, use, modify, sell and distribute this software
* is granted provided this copyright notice appears in all copies.
* This software is provided "as is" without express or implied
* warranty, and with no claim as to its suitability for any purpose.
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include "print.hpp"
#include <boost/compose.hpp>
using namespace std;
using namespace boost;
int main()
{
vector<int> coll;
// insert elements from 1 to 9
for (int i=1; i<=9; ++i) {
coll.push_back(i);
}
PRINT_ELEMENTS(coll);
// remove all elements that are greater than four and less than seven
// - retain new end
vector<int>::iterator pos;
pos = remove_if (coll.begin(),coll.end(),
compose_f_gx_hx(logical_and<bool>(),
bind2nd(greater<int>(),4),
bind2nd(less<int>(),7)));
// remove ``removed'' elements in coll
coll.erase(pos,coll.end());
PRINT_ELEMENTS(coll);
}

View File

@@ -1,59 +0,0 @@
<HTML>
<HEAD>
<TITLE>compose2.cpp</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF">
&nbsp;
<TABLE HEIGHT=40 WIDTH="100%">
<TR> <TD ALIGN=LEFT WIDTH="100%" BGCOLOR="#DDDDDD">
<FONT face="Arial,Helvetica" size=+2><B>
&nbsp;compose2.cpp
</B></FONT>
</TD></TR></TABLE><BR>
<FONT face="Arial,Helvetica"><B>
The following code example is taken from the book<BR>
<A HREF="http://www.josuttis.com/libbook/" TARGET="_top">
The C++ Standard Library - A Tutorial and Reference</A><BR>
by Nicolai M. Josuttis, Addison-Wesley, 1999<BR>
<A HREF="http://www.josuttis.com/libbook/copyright.html">
&copy; Copyright</A> Nicolai M. Josuttis 1999<BR>
</B></FONT>
<BR><BR><TT>
#include&nbsp;&lt;iostream&gt;<BR>
#include&nbsp;&lt;vector&gt;<BR>
#include&nbsp;&lt;algorithm&gt;<BR>
#include&nbsp;&lt;functional&gt;<BR>
#include&nbsp;"<A href="print.hpp.html">print.hpp</A>"<BR>
#include&nbsp;"<A href="compose.hpp.html">compose.hpp</A>"<BR>
using&nbsp;namespace&nbsp;std;<BR>
using&nbsp;namespace&nbsp;boost;<BR>
<BR>
int&nbsp;main()<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;vector&lt;int&gt;&nbsp;coll;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;insert&nbsp;elements&nbsp;from&nbsp;1&nbsp;to&nbsp;9</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(int&nbsp;i=1;&nbsp;i&lt;=9;&nbsp;++i)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;coll.push_back(i);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;PRINT_ELEMENTS(coll);<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;remove&nbsp;all&nbsp;elements&nbsp;that&nbsp;are&nbsp;greater&nbsp;than&nbsp;four&nbsp;and&nbsp;less&nbsp;than&nbsp;seven</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;-&nbsp;retain&nbsp;new&nbsp;end</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;vector&lt;int&gt;::iterator&nbsp;pos;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;pos&nbsp;=&nbsp;remove_if&nbsp;(coll.begin(),coll.end(),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;compose_f_gx_hx(logical_and&lt;bool&gt;(),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bind2nd(greater&lt;int&gt;(),4),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bind2nd(less&lt;int&gt;(),7)));<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;remove&nbsp;``removed''&nbsp;elements&nbsp;in&nbsp;coll</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;coll.erase(pos,coll.end());<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;PRINT_ELEMENTS(coll);<BR>
}<BR>
</TT>
</BODY>
</HTML>

View File

@@ -1,37 +0,0 @@
/* The following code example is taken from the book
* "The C++ Standard Library - A Tutorial and Reference"
* by Nicolai M. Josuttis, Addison-Wesley, 1999
*
* (C) Copyright Nicolai M. Josuttis 1999.
* Permission to copy, use, modify, sell and distribute this software
* is granted provided this copyright notice appears in all copies.
* This software is provided "as is" without express or implied
* warranty, and with no claim as to its suitability for any purpose.
*/
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <cctype>
#include <boost/compose.hpp>
using namespace std;
using namespace boost;
int main()
{
string s("Internationalization");
string sub("Nation");
// search substring case insensitive
string::iterator pos;
pos = search (s.begin(),s.end(), // string to search in
sub.begin(),sub.end(), // substring to search
compose_f_gx_hy(equal_to<int>(), // compar. criterion
ptr_fun(::toupper),
ptr_fun(::toupper)));
if (pos != s.end()) {
cout << "\"" << sub << "\" is part of \"" << s << "\""
<< endl;
}
}

View File

@@ -1,54 +0,0 @@
<HTML>
<HEAD>
<TITLE>compose3.cpp</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF">
&nbsp;
<TABLE HEIGHT=40 WIDTH="100%">
<TR> <TD ALIGN=LEFT WIDTH="100%" BGCOLOR="#DDDDDD">
<FONT face="Arial,Helvetica" size=+2><B>
&nbsp;compose3.cpp
</B></FONT>
</TD></TR></TABLE><BR>
<FONT face="Arial,Helvetica"><B>
The following code example is taken from the book<BR>
<A HREF="http://www.josuttis.com/libbook/" TARGET="_top">
The C++ Standard Library - A Tutorial and Reference</A><BR>
by Nicolai M. Josuttis, Addison-Wesley, 1999<BR>
<A HREF="http://www.josuttis.com/libbook/copyright.html">
&copy; Copyright</A> Nicolai M. Josuttis 1999<BR>
</B></FONT>
<BR><BR><TT>
#include&nbsp;&lt;iostream&gt;<BR>
#include&nbsp;&lt;algorithm&gt;<BR>
#include&nbsp;&lt;functional&gt;<BR>
#include&nbsp;&lt;string&gt;<BR>
#include&nbsp;&lt;cctype&gt;<BR>
#include&nbsp;"<A href="compose.hpp.html">compose.hpp</A>"<BR>
using&nbsp;namespace&nbsp;std;<BR>
using&nbsp;namespace&nbsp;boost;<BR>
<BR>
int&nbsp;main()<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;string&nbsp;s("Internationalization");<BR>
&nbsp;&nbsp;&nbsp;&nbsp;string&nbsp;sub("Nation");<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;search&nbsp;substring&nbsp;case&nbsp;insensitive</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;string::iterator&nbsp;pos;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;pos&nbsp;=&nbsp;search&nbsp;(s.begin(),s.end(),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;string&nbsp;to&nbsp;search&nbsp;in</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sub.begin(),sub.end(),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;substring&nbsp;to&nbsp;search</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;compose_f_gx_hy(equal_to&lt;int&gt;(),&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;compar.&nbsp;criterion</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ptr_fun(::toupper),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ptr_fun(::toupper)));<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(pos&nbsp;!=&nbsp;s.end())&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&nbsp;&lt;&lt;&nbsp;"\""&nbsp;&lt;&lt;&nbsp;sub&nbsp;&lt;&lt;&nbsp;"\"&nbsp;is&nbsp;part&nbsp;of&nbsp;\""&nbsp;&lt;&lt;&nbsp;s&nbsp;&lt;&lt;&nbsp;"\""<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&nbsp;endl;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
}<BR>
</TT>
</BODY>
</HTML>

View File

@@ -1,37 +0,0 @@
/* The following code example is taken from the book
* "The C++ Standard Library - A Tutorial and Reference"
* by Nicolai M. Josuttis, Addison-Wesley, 1999
*
* (C) Copyright Nicolai M. Josuttis 1999.
* Permission to copy, use, modify, sell and distribute this software
* is granted provided this copyright notice appears in all copies.
* This software is provided "as is" without express or implied
* warranty, and with no claim as to its suitability for any purpose.
*/
#include <list>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include "print.hpp"
#include <boost/compose.hpp>
using namespace std;
using namespace boost;
int main()
{
list<int> coll;
// insert five random numbers
generate_n (back_inserter(coll), // beginning of destination range
5, // count
rand); // new value generator
PRINT_ELEMENTS(coll);
// overwrite with five new random numbers
// in the range between 0 (including) and 10 (excluding)
generate (coll.begin(), coll.end(), // destination range
compose_f_g(bind2nd(modulus<int>(),10),
ptr_fun(rand)));
PRINT_ELEMENTS(coll);
}

View File

@@ -1,54 +0,0 @@
<HTML>
<HEAD>
<TITLE>compose4.cpp</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF">
&nbsp;
<TABLE HEIGHT=40 WIDTH="100%">
<TR> <TD ALIGN=LEFT WIDTH="100%" BGCOLOR="#DDDDDD">
<FONT face="Arial,Helvetica" size=+2><B>
&nbsp;compose4.cpp
</B></FONT>
</TD></TR></TABLE><BR>
<FONT face="Arial,Helvetica"><B>
The following code example is taken from the book<BR>
<A HREF="http://www.josuttis.com/libbook/" TARGET="_top">
The C++ Standard Library - A Tutorial and Reference</A><BR>
by Nicolai M. Josuttis, Addison-Wesley, 1999<BR>
<A HREF="http://www.josuttis.com/libbook/copyright.html">
&copy; Copyright</A> Nicolai M. Josuttis 1999<BR>
</B></FONT>
<BR><BR><TT>
#include&nbsp;&lt;list&gt;<BR>
#include&nbsp;&lt;algorithm&gt;<BR>
#include&nbsp;&lt;functional&gt;<BR>
#include&nbsp;&lt;cstdlib&gt;<BR>
#include&nbsp;"<A href="print.hpp.html">print.hpp</A>"<BR>
#include&nbsp;"<A href="compose.hpp.html">compose.hpp</A>"<BR>
using&nbsp;namespace&nbsp;std;<BR>
using&nbsp;namespace&nbsp;boost;<BR>
<BR>
<BR>
int&nbsp;main()<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;list&lt;int&gt;&nbsp;coll;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;insert&nbsp;five&nbsp;random&nbsp;numbers</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;generate_n&nbsp;(back_inserter(coll),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;beginning&nbsp;of&nbsp;destination&nbsp;range</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;count</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rand);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;new&nbsp;value&nbsp;generator</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;PRINT_ELEMENTS(coll);<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;overwrite&nbsp;with&nbsp;five&nbsp;new&nbsp;random&nbsp;numbers</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;in&nbsp;the&nbsp;range&nbsp;between&nbsp;0&nbsp;(including)&nbsp;and&nbsp;10&nbsp;(excluding)</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;generate&nbsp;(coll.begin(),&nbsp;coll.end(),&nbsp;&nbsp;&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>//&nbsp;destination&nbsp;range</I></FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;compose_f_g(bind2nd(modulus&lt;int&gt;(),10),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ptr_fun(rand)));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;PRINT_ELEMENTS(coll);<BR>
}<BR>
</TT>
</BODY>
</HTML>

View File

@@ -1,50 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Boost Compose Library</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table border="1" bgcolor="#007F7F" cellpadding="2">
<tr>
<td bgcolor="#FFFFFF"><img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" WIDTH="277" HEIGHT="86"></td>
<td><a href="../../index.htm"><font face="Arial" color="#FFFFFF"><big>Home </big></font></a></td>
<td><a href="../libraries.htm"><font face="Arial" color="#FFFFFF"><big>Libraries </big></font></a></td>
<td><a href="../../people/people.htm"><font face="Arial" color="#FFFFFF"><big>People </big></font></a></td>
<td><a href="../../more/faq.htm"><font face="Arial" color="#FFFFFF"><big>FAQ </big></font></a></td>
<td><a href="../../more/index.htm"><font face="Arial" color="#FFFFFF"><big>More </big></font></a></td>
</tr>
</table>
<h1>Compose library</h1>
<p>The header compose.hpp provides compose function object adapter extensions for use with
the Standard Template Library (STL) portion of the C++ Standard Library.&nbsp; If you
aren't currently using the STL, these compose adapters won't be of any interest, but
hard-core STL users will appreciate their usefulness.
<ul>
<li><a href="compose.html">Documentation</a> (HTML).</li>
<li>Header <a href="../../boost/compose.hpp">compose.hpp</a>.&nbsp; May also view as an <a href="compose.hpp.html">HTML</a> file.</li>
<li>See the <a href="compose.html">documentation</a> for links to sample programs.</li>
<li>Header <a href="print.hpp">print.hpp</a> used by sample programs.&nbsp; May also view as
an <a href="print.hpp.html">HTML</a> file.</li>
<li>Submitted by <a href="../../people/people.htm">Nicolai Josuttis</a>.</li>
</ul>
<h3>Comment on names</h3>
<p>In preparing this library, Nico asked the boost mailing list for suggestions as to good
names for these functions.&nbsp; Jerry Schwarz suggested the <tt>compose_f_...</tt>
function naming scheme, which was generally agreed to be an improvement over prior
schemes.&nbsp; There was also discussion of names representing the 0 argument concept,
with <tt>nullary</tt> picked as the least of several evils.</p>
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->14 March, 2001<!--webbot bot="Timestamp" endspan i-checksum="28773" -->
&nbsp;&nbsp; </p>
<p>&nbsp;</p>
</body>
</html>

View File

@@ -1,28 +0,0 @@
/* The following code example is taken from the book
* "The C++ Standard Library - A Tutorial and Reference"
* by Nicolai M. Josuttis, Addison-Wesley, 1999
*
* (C) Copyright Nicolai M. Josuttis 1999.
* Permission to copy, use, modify, sell and distribute this software
* is granted provided this copyright notice appears in all copies.
* This software is provided "as is" without express or implied
* warranty, and with no claim as to its suitability for any purpose.
*/
#include <iostream>
/* PRINT_ELEMENTS()
* - prints optional C-string optcstr followed by
* - all elements of the collection coll
* - separated by spaces
*/
template <class T>
inline void PRINT_ELEMENTS (const T& coll, const char* optcstr="")
{
typename T::const_iterator pos;
std::cout << optcstr;
for (pos=coll.begin(); pos!=coll.end(); ++pos) {
std::cout << *pos << ' ';
}
std::cout << std::endl;
}

View File

@@ -1,45 +0,0 @@
<HTML>
<HEAD>
<TITLE>PRINT_ELEMENTS()</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF">
&nbsp;
<TABLE HEIGHT=40 WIDTH="100%">
<TR> <TD ALIGN=LEFT WIDTH="100%" BGCOLOR="#DDDDDD">
<FONT face="Arial,Helvetica" size=+2><B>
&nbsp;PRINT_ELEMENTS()
</B></FONT>
</TD></TR></TABLE><BR>
<FONT face="Arial,Helvetica"><B>
The following code example is taken from the book<BR>
<A HREF="http://www.josuttis.com/libbook/" TARGET="_top">
The C++ Standard Library - A Tutorial and Reference</A><BR>
by Nicolai M. Josuttis, Addison-Wesley, 1999<BR>
<A HREF="http://www.josuttis.com/libbook/copyright.html">
&copy; Copyright</A> Nicolai M. Josuttis 1999<BR>
</B></FONT>
<BR><BR><TT>
#include&nbsp;&lt;iostream&gt;<BR>
<BR>
<Font color="0000FF" >/</FONT><I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;PRINT_ELEMENTS()</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;-&nbsp;prints&nbsp;optional&nbsp;C-string&nbsp;optcstr&nbsp;followed&nbsp;by</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;-&nbsp;all&nbsp;elements&nbsp;of&nbsp;the&nbsp;collection&nbsp;coll</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*&nbsp;-&nbsp;separated&nbsp;by&nbsp;spaces</I></FONT><BR>
&nbsp;<I><FONT face="Arial,Helvetica" color="0000FF" size=-1>*/</I></FONT><BR>
template&nbsp;&lt;class&nbsp;T&gt;<BR>
inline&nbsp;void&nbsp;PRINT_ELEMENTS&nbsp;(const&nbsp;T&&nbsp;coll,&nbsp;const&nbsp;char*&nbsp;optcstr="")<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;typename&nbsp;T::const_iterator&nbsp;pos;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;std::cout&nbsp;&lt;&lt;&nbsp;optcstr;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(pos=coll.begin();&nbsp;pos!=coll.end();&nbsp;++pos)&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::cout&nbsp;&lt;&lt;&nbsp;*pos&nbsp;&lt;&lt;&nbsp;'&nbsp;';<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;std::cout&nbsp;&lt;&lt;&nbsp;std::endl;<BR>
}<BR>
</TT>
</BODY>
</HTML>