• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>invoke_procedure</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="invoke.html" title="invoke">
10<link rel="next" href="invoke_fobj.html" title="invoke_function_object">
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="invoke.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="invoke_fobj.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.invocation.functions.invoke_proc"></a><a class="link" href="invoke_proc.html" title="invoke_procedure">invoke_procedure</a>
28</h5></div></div></div>
29<h6>
30<a name="fusion.functional.invocation.functions.invoke_proc.h0"></a>
31            <span class="phrase"><a name="fusion.functional.invocation.functions.invoke_proc.description"></a></span><a class="link" href="invoke_proc.html#fusion.functional.invocation.functions.invoke_proc.description">Description</a>
32          </h6>
33<p>
34            Calls a <a class="link" href="../../concepts/callable.html" title="Callable Object">Callable
35            Object</a> with the arguments from a <a class="link" href="../../../sequence.html" title="Sequence">Sequence</a>.
36            The result of the call is ignored.
37          </p>
38<p>
39            The first template parameter can be specialized explicitly to avoid copying
40            and/or to control the const qualification of a function object.
41          </p>
42<p>
43            For pointers to class members corresponding object can be specified as
44            a reference, pointer, or smart pointer. In case of the latter, a freestanding
45            <code class="literal">get_pointer</code> function must be defined (Boost provides
46            this function for <code class="literal">std::auto_ptr</code> and <a href="http://www.boost.org/libs/smart_ptr#shared_ptr" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span></code></a>).
47          </p>
48<p>
49            The target function must not be a pointer to a member object (dereferencing
50            such a pointer without returning anything does not make sense, so it
51            isn't implemented).
52          </p>
53<h6>
54<a name="fusion.functional.invocation.functions.invoke_proc.h1"></a>
55            <span class="phrase"><a name="fusion.functional.invocation.functions.invoke_proc.synopsis"></a></span><a class="link" href="invoke_proc.html#fusion.functional.invocation.functions.invoke_proc.synopsis">Synopsis</a>
56          </h6>
57<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span>
58    <span class="keyword">typename</span> <span class="identifier">Function</span><span class="special">,</span>
59    <span class="keyword">class</span> <span class="identifier">Sequence</span>
60    <span class="special">&gt;</span>
61<span class="keyword">typename</span> <a class="link" href="../metafunctions/invoke_proc.html" title="invoke_procedure"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">invoke_procedure</span></code></a><span class="special">&lt;</span><span class="identifier">Function</span><span class="special">,</span> <span class="identifier">Sequence</span><span class="special">&gt;::</span><span class="identifier">type</span>
62<span class="identifier">invoke_procedure</span><span class="special">(</span><span class="identifier">Function</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">Sequence</span> <span class="special">&amp;</span> <span class="identifier">s</span><span class="special">);</span>
63
64<span class="keyword">template</span><span class="special">&lt;</span>
65    <span class="keyword">typename</span> <span class="identifier">Function</span><span class="special">,</span>
66    <span class="keyword">class</span> <span class="identifier">Sequence</span>
67    <span class="special">&gt;</span>
68<span class="keyword">typename</span> <a class="link" href="../metafunctions/invoke_proc.html" title="invoke_procedure"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">invoke_procedure</span></code></a><span class="special">&lt;</span><span class="identifier">Function</span><span class="special">,</span> <span class="identifier">Sequence</span> <span class="keyword">const</span><span class="special">&gt;::</span><span class="identifier">type</span>
69<span class="identifier">invoke_procedure</span><span class="special">(</span><span class="identifier">Function</span> <span class="identifier">f</span><span class="special">,</span> <span class="identifier">Sequence</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">s</span><span class="special">);</span>
70</pre>
71<h6>
72<a name="fusion.functional.invocation.functions.invoke_proc.h2"></a>
73            <span class="phrase"><a name="fusion.functional.invocation.functions.invoke_proc.parameters"></a></span><a class="link" href="invoke_proc.html#fusion.functional.invocation.functions.invoke_proc.parameters">Parameters</a>
74          </h6>
75<div class="informaltable"><table class="table">
76<colgroup>
77<col>
78<col>
79<col>
80</colgroup>
81<thead><tr>
82<th>
83                    <p>
84                      Parameter
85                    </p>
86                  </th>
87<th>
88                    <p>
89                      Requirement
90                    </p>
91                  </th>
92<th>
93                    <p>
94                      Description
95                    </p>
96                  </th>
97</tr></thead>
98<tbody>
99<tr>
100<td>
101                    <p>
102                      <code class="computeroutput"><span class="identifier">f</span></code>
103                    </p>
104                  </td>
105<td>
106                    <p>
107                      Model of <a class="link" href="../../concepts/callable.html" title="Callable Object">Callable
108                      Object</a>
109                    </p>
110                  </td>
111<td>
112                    <p>
113                      The function to call.
114                    </p>
115                  </td>
116</tr>
117<tr>
118<td>
119                    <p>
120                      <code class="computeroutput"><span class="identifier">s</span></code>
121                    </p>
122                  </td>
123<td>
124                    <p>
125                      Model of <a class="link" href="../../../sequence/concepts/forward_sequence.html" title="Forward Sequence">Forward
126                      Sequence</a>
127                    </p>
128                  </td>
129<td>
130                    <p>
131                      The arguments.
132                    </p>
133                  </td>
134</tr>
135</tbody>
136</table></div>
137<h6>
138<a name="fusion.functional.invocation.functions.invoke_proc.h3"></a>
139            <span class="phrase"><a name="fusion.functional.invocation.functions.invoke_proc.expression_semantics"></a></span><a class="link" href="invoke_proc.html#fusion.functional.invocation.functions.invoke_proc.expression_semantics">Expression
140            Semantics</a>
141          </h6>
142<pre class="programlisting"><span class="identifier">invoke_procedure</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span><span class="identifier">s</span><span class="special">);</span>
143</pre>
144<p>
145            <span class="bold"><strong>Return type</strong></span>: <code class="computeroutput"><span class="keyword">void</span></code>
146          </p>
147<p>
148            <span class="bold"><strong>Semantics</strong></span>: Invokes <code class="computeroutput"><span class="identifier">f</span></code>
149            with the elements in <code class="computeroutput"><span class="identifier">s</span></code>
150            as arguments.
151          </p>
152<h6>
153<a name="fusion.functional.invocation.functions.invoke_proc.h4"></a>
154            <span class="phrase"><a name="fusion.functional.invocation.functions.invoke_proc.header"></a></span><a class="link" href="invoke_proc.html#fusion.functional.invocation.functions.invoke_proc.header">Header</a>
155          </h6>
156<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">invocation</span><span class="special">/</span><span class="identifier">invoke_procedure</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
157</pre>
158<h6>
159<a name="fusion.functional.invocation.functions.invoke_proc.h5"></a>
160            <span class="phrase"><a name="fusion.functional.invocation.functions.invoke_proc.example"></a></span><a class="link" href="invoke_proc.html#fusion.functional.invocation.functions.invoke_proc.example">Example</a>
161          </h6>
162<pre class="programlisting"><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">int</span><span class="special">&gt;</span> <span class="identifier">v</span><span class="special">(</span><span class="number">1</span><span class="special">,</span><span class="number">2</span><span class="special">);</span>
163<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">lambda</span><span class="special">;</span>
164<span class="identifier">invoke_procedure</span><span class="special">(</span><span class="identifier">_1</span> <span class="special">+=</span> <span class="identifier">_2</span><span class="special">,</span> <span class="identifier">v</span><span class="special">);</span>
165<span class="identifier">assert</span><span class="special">(</span><a class="link" href="../../../sequence/intrinsic/functions/front.html" title="front"><code class="computeroutput"><span class="identifier">front</span></code></a><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special">==</span> <span class="number">3</span><span class="special">);</span>
166</pre>
167<h6>
168<a name="fusion.functional.invocation.functions.invoke_proc.h6"></a>
169            <span class="phrase"><a name="fusion.functional.invocation.functions.invoke_proc.see_also"></a></span><a class="link" href="invoke_proc.html#fusion.functional.invocation.functions.invoke_proc.see_also">See
170            also</a>
171          </h6>
172<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
173<li class="listitem">
174                <a class="link" href="invoke.html" title="invoke"><code class="computeroutput"><span class="identifier">invoke</span></code></a>
175              </li>
176<li class="listitem">
177                <a class="link" href="invoke_fobj.html" title="invoke_function_object"><code class="computeroutput"><span class="identifier">invoke_function_object</span></code></a>
178              </li>
179<li class="listitem">
180                <a class="link" href="../metafunctions/invoke_proc.html" title="invoke_procedure"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">invoke_procedure</span></code></a>
181              </li>
182<li class="listitem">
183                <a class="link" href="../../adapters/fused_procedure.html" title="fused_procedure"><code class="computeroutput"><span class="identifier">fused_procedure</span></code></a>
184              </li>
185<li class="listitem">
186                <a class="link" href="../../generation/functions/mk_fused_proc.html" title="make_fused_procedure"><code class="computeroutput"><span class="identifier">make_fused_procedure</span></code></a>
187              </li>
188</ul></div>
189</div>
190<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
191<td align="left"></td>
192<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman,
193      Dan Marsden, Tobias Schwinger<p>
194        Distributed under the Boost Software License, Version 1.0. (See accompanying
195        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>)
196      </p>
197</div></td>
198</tr></table>
199<hr>
200<div class="spirit-nav">
201<a accesskey="p" href="invoke.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="invoke_fobj.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
202</div>
203</body>
204</html>
205