• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>make_fused_function_object</title>
5<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../../index.html" title="Chapter 1. Fusion 2.2">
8<link rel="up" href="../functions.html" title="Functions">
9<link rel="prev" href="mk_fused_proc.html" title="make_fused_procedure">
10<link rel="next" href="mk_unfused.html" title="make_unfused">
11</head>
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>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="mk_fused_proc.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../functions.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="mk_unfused.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h5 class="title">
27<a name="fusion.functional.generation.functions.mk_fused_fobj"></a><a class="link" href="mk_fused_fobj.html" title="make_fused_function_object">make_fused_function_object</a>
28</h5></div></div></div>
29<h6>
30<a name="fusion.functional.generation.functions.mk_fused_fobj.h0"></a>
31            <span class="phrase"><a name="fusion.functional.generation.functions.mk_fused_fobj.description"></a></span><a class="link" href="mk_fused_fobj.html#fusion.functional.generation.functions.mk_fused_fobj.description">Description</a>
32          </h6>
33<p>
34            Creates a <a class="link" href="../../adapters/fused_function_object.html" title="fused_function_object"><code class="computeroutput"><span class="identifier">fused_function_object</span></code></a> adapter
35            for a given <a class="link" href="../../concepts/def_callable.html" title="Deferred Callable Object">Deferred
36            Callable Object</a>. The usual <a class="link" href="../../../notes.html#fusion.notes.element_conversion"><span class="emphasis"><em>element
37            conversion</em></span></a> is applied to the target function.
38          </p>
39<h6>
40<a name="fusion.functional.generation.functions.mk_fused_fobj.h1"></a>
41            <span class="phrase"><a name="fusion.functional.generation.functions.mk_fused_fobj.synopsis"></a></span><a class="link" href="mk_fused_fobj.html#fusion.functional.generation.functions.mk_fused_fobj.synopsis">Synopsis</a>
42          </h6>
43<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">&gt;</span>
44<span class="keyword">inline</span> <span class="keyword">typename</span> <a class="link" href="../metafunctions/mk_fused_fobj.html" title="make_fused_function_object"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">make_fused_function_object</span></code></a><span class="special">&lt;</span><span class="identifier">F</span><span class="special">&gt;::</span><span class="identifier">type</span>
45<span class="identifier">make_fused_function_object</span><span class="special">(</span><span class="identifier">F</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">f</span><span class="special">);</span>
46</pre>
47<h6>
48<a name="fusion.functional.generation.functions.mk_fused_fobj.h2"></a>
49            <span class="phrase"><a name="fusion.functional.generation.functions.mk_fused_fobj.parameters"></a></span><a class="link" href="mk_fused_fobj.html#fusion.functional.generation.functions.mk_fused_fobj.parameters">Parameters</a>
50          </h6>
51<div class="informaltable"><table class="table">
52<colgroup>
53<col>
54<col>
55<col>
56</colgroup>
57<thead><tr>
58<th>
59                    <p>
60                      Parameter
61                    </p>
62                  </th>
63<th>
64                    <p>
65                      Requirement
66                    </p>
67                  </th>
68<th>
69                    <p>
70                      Description
71                    </p>
72                  </th>
73</tr></thead>
74<tbody><tr>
75<td>
76                    <p>
77                      <code class="computeroutput"><span class="identifier">f</span></code>
78                    </p>
79                  </td>
80<td>
81                    <p>
82                      Model of <a class="link" href="../../concepts/poly.html" title="Polymorphic Function Object">Polymorphic
83                      Function Object</a>
84                    </p>
85                  </td>
86<td>
87                    <p>
88                      The function to transform.
89                    </p>
90                  </td>
91</tr></tbody>
92</table></div>
93<h6>
94<a name="fusion.functional.generation.functions.mk_fused_fobj.h3"></a>
95            <span class="phrase"><a name="fusion.functional.generation.functions.mk_fused_fobj.expression_semantics"></a></span><a class="link" href="mk_fused_fobj.html#fusion.functional.generation.functions.mk_fused_fobj.expression_semantics">Expression
96            Semantics</a>
97          </h6>
98<pre class="programlisting"><span class="identifier">make_fused_function_object</span><span class="special">(</span><span class="identifier">f</span><span class="special">);</span>
99</pre>
100<p>
101            <span class="bold"><strong>Return type</strong></span>: A specialization of <a class="link" href="../../adapters/fused_function_object.html" title="fused_function_object"><code class="computeroutput"><span class="identifier">fused_function_object</span></code></a>.
102          </p>
103<p>
104            <span class="bold"><strong>Semantics</strong></span>: Returns a <a class="link" href="../../adapters/fused_function_object.html" title="fused_function_object"><code class="computeroutput"><span class="identifier">fused_function_object</span></code></a> adapter
105            for <code class="computeroutput"><span class="identifier">f</span></code>.
106          </p>
107<h6>
108<a name="fusion.functional.generation.functions.mk_fused_fobj.h4"></a>
109            <span class="phrase"><a name="fusion.functional.generation.functions.mk_fused_fobj.header"></a></span><a class="link" href="mk_fused_fobj.html#fusion.functional.generation.functions.mk_fused_fobj.header">Header</a>
110          </h6>
111<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</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">generation</span><span class="special">/</span><span class="identifier">make_fused_function_object</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
112<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">make_fused_function_object</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
113</pre>
114<h6>
115<a name="fusion.functional.generation.functions.mk_fused_fobj.h5"></a>
116            <span class="phrase"><a name="fusion.functional.generation.functions.mk_fused_fobj.example"></a></span><a class="link" href="mk_fused_fobj.html#fusion.functional.generation.functions.mk_fused_fobj.example">Example</a>
117          </h6>
118<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">sub</span>
119<span class="special">{</span>
120    <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Sig</span><span class="special">&gt;</span>
121    <span class="keyword">struct</span> <span class="identifier">result</span><span class="special">;</span>
122
123    <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Self</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T</span><span class="special">&gt;</span>
124    <span class="keyword">struct</span> <span class="identifier">result</span><span class="special">&lt;</span> <span class="identifier">Self</span><span class="special">(</span><span class="identifier">T</span><span class="special">,</span><span class="identifier">T</span><span class="special">)</span> <span class="special">&gt;</span>
125    <span class="special">{</span> <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">remove_reference</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
126
127    <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">&gt;</span>
128    <span class="identifier">T</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">T</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="identifier">T</span> <span class="identifier">rhs</span><span class="special">)</span> <span class="keyword">const</span>
129    <span class="special">{</span>
130        <span class="keyword">return</span> <span class="identifier">lhs</span> <span class="special">-</span> <span class="identifier">rhs</span><span class="special">;</span>
131    <span class="special">}</span>
132<span class="special">};</span>
133
134<span class="keyword">void</span> <span class="identifier">try_it</span><span class="special">()</span>
135<span class="special">{</span>
136    <a class="link" href="../../../container/vector.html" title="vector"><code class="computeroutput"><span class="identifier">vector</span></code></a><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span><span class="keyword">float</span><span class="special">&gt;</span> <span class="identifier">a</span><span class="special">(</span><span class="number">2</span><span class="special">,</span><span class="number">2.0f</span><span class="special">);</span>
137    <a class="link" href="../../../container/vector.html" title="vector"><code class="computeroutput"><span class="identifier">vector</span></code></a><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span><span class="keyword">float</span><span class="special">&gt;</span> <span class="identifier">b</span><span class="special">(</span><span class="number">1</span><span class="special">,</span><span class="number">1.5f</span><span class="special">);</span>
138    <a class="link" href="../../../container/vector.html" title="vector"><code class="computeroutput"><span class="identifier">vector</span></code></a><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span><span class="keyword">float</span><span class="special">&gt;</span> <span class="identifier">c</span><span class="special">(</span><span class="number">1</span><span class="special">,</span><span class="number">0.5f</span><span class="special">);</span>
139    <span class="identifier">assert</span><span class="special">(</span><span class="identifier">c</span> <span class="special">==</span> <a class="link" href="../../../algorithm/transformation/functions/transform.html" title="transform"><code class="computeroutput"><span class="identifier">transform</span></code></a><span class="special">(</span><a class="link" href="../../../algorithm/transformation/functions/zip.html" title="zip"><code class="computeroutput"><span class="identifier">zip</span></code></a><span class="special">(</span><span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">),</span> <span class="identifier">make_fused_function_object</span><span class="special">(</span><span class="identifier">sub</span><span class="special">())));</span>
140<span class="special">}</span>
141</pre>
142<h6>
143<a name="fusion.functional.generation.functions.mk_fused_fobj.h6"></a>
144            <span class="phrase"><a name="fusion.functional.generation.functions.mk_fused_fobj.see_also"></a></span><a class="link" href="mk_fused_fobj.html#fusion.functional.generation.functions.mk_fused_fobj.see_also">See
145            also</a>
146          </h6>
147<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
148<li class="listitem">
149                <a class="link" href="../../adapters/fused_function_object.html" title="fused_function_object"><code class="computeroutput"><span class="identifier">fused_function_object</span></code></a>
150              </li>
151<li class="listitem">
152                <a class="link" href="../../../support/deduce.html" title="deduce"><code class="computeroutput"><span class="identifier">deduce</span></code></a>
153              </li>
154<li class="listitem">
155                <a class="link" href="../metafunctions/mk_fused_fobj.html" title="make_fused_function_object"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">make_fused_function_object</span></code></a>
156              </li>
157</ul></div>
158</div>
159<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
160<td align="left"></td>
161<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman,
162      Dan Marsden, Tobias Schwinger<p>
163        Distributed under the Boost Software License, Version 1.0. (See accompanying
164        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>)
165      </p>
166</div></td>
167</tr></table>
168<hr>
169<div class="spirit-nav">
170<a accesskey="p" href="mk_fused_proc.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../functions.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="mk_unfused.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
171</div>
172</body>
173</html>
174