3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
5 <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7 <link rel="home" href="../../../index.html" title="Chapter 1. Fusion 2.2">
8 <link rel="up" href="../adapters.html" title="Adapters">
9 <link rel="prev" href="../adapters.html" title="Adapters">
10 <link rel="next" href="fused_procedure.html" title="fused_procedure">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
22 <div class="spirit-nav">
23 <a accesskey="p" href="../adapters.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../adapters.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="fused_procedure.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="fusion.functional.adapters.fused"></a><a class="link" href="fused.html" title="fused">fused</a>
28 </h4></div></div></div>
30 <a name="fusion.functional.adapters.fused.h0"></a>
31 <span class="phrase"><a name="fusion.functional.adapters.fused.description"></a></span><a class="link" href="fused.html#fusion.functional.adapters.fused.description">Description</a>
34 An unary <a class="link" href="../concepts/poly.html" title="Polymorphic Function Object">Polymorphic Function
35 Object</a> adapter template for <a class="link" href="../concepts/def_callable.html" title="Deferred Callable Object">Deferred
36 Callable Object</a> target functions. It takes a <a class="link" href="../../sequence/concepts/forward_sequence.html" title="Forward Sequence">Forward
37 Sequence</a> that contains the arguments for the target function.
40 The type of the target function is allowed to be const qualified or a reference.
41 Const qualification is preserved and propagated appropriately (in other
42 words, only const versions of <code class="literal">operator()</code> can be used
43 for a target function object that is const or, if the target function object
44 is held by value, the adapter is const - these semantics have nothing to
45 do with the const qualification of a member function, which is referring
46 to the type of object pointed to by <code class="literal">this</code> which is specified
47 with the first element in the sequence passed to the adapter).
50 If the target function is a pointer to a class members, the corresponding
51 object can be specified as a reference, pointer, or smart pointer. In case
52 of the latter, a freestanding <code class="literal">get_pointer</code> function must
53 be defined (Boost provides this function for <code class="literal">std::auto_ptr</code>
54 and <a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span></code></a>).
57 <a name="fusion.functional.adapters.fused.h1"></a>
58 <span class="phrase"><a name="fusion.functional.adapters.fused.header"></a></span><a class="link" href="fused.html#fusion.functional.adapters.fused.header">Header</a>
60 <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">functional</span><span class="special">/</span><span class="identifier">adapter</span><span class="special">/</span><span class="identifier">fused</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
63 <a name="fusion.functional.adapters.fused.h2"></a>
64 <span class="phrase"><a name="fusion.functional.adapters.fused.synopsis"></a></span><a class="link" href="fused.html#fusion.functional.adapters.fused.synopsis">Synopsis</a>
66 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Function</span><span class="special">></span>
67 <span class="keyword">class</span> <span class="identifier">fused</span><span class="special">;</span>
70 <a name="fusion.functional.adapters.fused.h3"></a>
71 <span class="phrase"><a name="fusion.functional.adapters.fused.template_parameters"></a></span><a class="link" href="fused.html#fusion.functional.adapters.fused.template_parameters">Template
74 <div class="informaltable"><table class="table">
100 <code class="computeroutput"><span class="identifier">Function</span></code>
105 A <a class="link" href="../concepts/def_callable.html" title="Deferred Callable Object">Deferred
114 <a name="fusion.functional.adapters.fused.h4"></a>
115 <span class="phrase"><a name="fusion.functional.adapters.fused.model_of"></a></span><a class="link" href="fused.html#fusion.functional.adapters.fused.model_of">Model
118 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
119 <li class="listitem">
120 <a class="link" href="../concepts/poly.html" title="Polymorphic Function Object">Polymorphic Function
123 <li class="listitem">
124 <a class="link" href="../concepts/def_callable.html" title="Deferred Callable Object">Deferred Callable
128 <div class="variablelist">
129 <p class="title"><b>Notation</b></p>
130 <dl class="variablelist">
131 <dt><span class="term"><code class="computeroutput"><span class="identifier">R</span></code></span></dt>
133 A possibly const qualified <a class="link" href="../concepts/def_callable.html" title="Deferred Callable Object">Deferred
134 Callable Object</a> type or reference type thereof
136 <dt><span class="term"><code class="computeroutput"><span class="identifier">r</span></code></span></dt>
138 An object convertible to <code class="computeroutput"><span class="identifier">R</span></code>
140 <dt><span class="term"><code class="computeroutput"><span class="identifier">s</span></code></span></dt>
142 A <a class="link" href="../../sequence.html" title="Sequence">Sequence</a> of arguments that
143 are accepted by <code class="computeroutput"><span class="identifier">r</span></code>
145 <dt><span class="term"><code class="computeroutput"><span class="identifier">f</span></code></span></dt>
147 An instance of <code class="computeroutput"><span class="identifier">fused</span><span class="special"><</span><span class="identifier">R</span><span class="special">></span></code>
152 <a name="fusion.functional.adapters.fused.h5"></a>
153 <span class="phrase"><a name="fusion.functional.adapters.fused.expression_semantics"></a></span><a class="link" href="fused.html#fusion.functional.adapters.fused.expression_semantics">Expression
156 <div class="informaltable"><table class="table">
177 <code class="computeroutput"><span class="identifier">fused</span><span class="special"><</span><span class="identifier">R</span><span class="special">>(</span><span class="identifier">r</span><span class="special">)</span></code>
182 Creates a fused function as described above, initializes the
183 target function with <code class="computeroutput"><span class="identifier">r</span></code>.
190 <code class="computeroutput"><span class="identifier">fused</span><span class="special"><</span><span class="identifier">R</span><span class="special">>()</span></code>
195 Creates a fused function as described above, attempts to use
196 <code class="computeroutput"><span class="identifier">R</span></code>'s default constructor.
203 <code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code>
208 Calls <code class="computeroutput"><span class="identifier">r</span></code> with
209 the elements in <code class="computeroutput"><span class="identifier">s</span></code>
217 <a name="fusion.functional.adapters.fused.h6"></a>
218 <span class="phrase"><a name="fusion.functional.adapters.fused.example"></a></span><a class="link" href="fused.html#fusion.functional.adapters.fused.example">Example</a>
220 <pre class="programlisting"><span class="identifier">fused</span><span class="special"><</span> <a href="http://www.sgi.com/tech/stl/plus.html" target="_top"><code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">plus</span></code></a><span class="special"><</span><span class="keyword">long</span><span class="special">></span> <span class="special">></span> <span class="identifier">f</span><span class="special">;</span>
221 <span class="identifier">assert</span><span class="special">(</span><span class="identifier">f</span><span class="special">(</span><a class="link" href="../../container/generation/functions/make_vector.html" title="make_vector"><code class="computeroutput"><span class="identifier">make_vector</span></code></a><span class="special">(</span><span class="number">1</span><span class="special">,</span><span class="number">2l</span><span class="special">))</span> <span class="special">==</span> <span class="number">3l</span><span class="special">);</span>
224 <a name="fusion.functional.adapters.fused.h7"></a>
225 <span class="phrase"><a name="fusion.functional.adapters.fused.see_also"></a></span><a class="link" href="fused.html#fusion.functional.adapters.fused.see_also">See
228 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
229 <li class="listitem">
230 <a class="link" href="fused_procedure.html" title="fused_procedure"><code class="computeroutput"><span class="identifier">fused_procedure</span></code></a>
232 <li class="listitem">
233 <a class="link" href="fused_function_object.html" title="fused_function_object"><code class="computeroutput"><span class="identifier">fused_function_object</span></code></a>
235 <li class="listitem">
236 <a class="link" href="../invocation/functions/invoke.html" title="invoke"><code class="computeroutput"><span class="identifier">invoke</span></code></a>
238 <li class="listitem">
239 <a class="link" href="../generation/functions/mk_fused.html" title="make_fused"><code class="computeroutput"><span class="identifier">make_fused</span></code></a>
241 <li class="listitem">
242 <a class="link" href="../../support/deduce.html" title="deduce"><code class="computeroutput"><span class="identifier">deduce</span></code></a>
246 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
247 <td align="left"></td>
248 <td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman,
249 Dan Marsden, Tobias Schwinger<p>
250 Distributed under the Boost Software License, Version 1.0. (See accompanying
251 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
256 <div class="spirit-nav">
257 <a accesskey="p" href="../adapters.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../adapters.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="fused_procedure.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>