Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/doc/html/boost/functionN.html @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 41.9 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>Class template functionN</title>
5<link rel="stylesheet" href="../boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
7<link rel="start" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
8<link rel="up" href="../function/reference.html#header.boost.function.hpp" title="Header &lt;boost/function.hpp&gt;">
9<link rel="prev" href="function_base.html" title="Class function_base">
10<link rel="next" href="function.html" title="Class template function">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%">
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
15<td align="center"><a href="../../../index.htm">Home</a></td>
16<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="../../../people/people.htm">People</a></td>
18<td align="center"><a href="../../../more/faq.htm">FAQ</a></td>
19<td align="center"><a href="../../../more/index.htm">More</a></td>
20</table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="function_base.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../function/reference.html#header.boost.function.hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="function.html"><img src="../images/next.png" alt="Next"></a>
24</div>
25<div class="refentry" lang="en">
26<a name="boost.functionN"></a><div class="titlepage"></div>
27<div class="refnamediv">
28<h2><span class="refentrytitle">Class template functionN</span></h2>
29<p>boost::functionN &#8212; A set of generalized function pointers that can be used for callbacks or wrapping function objects.</p>
30</div>
31<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
32<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> R, <span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN,
33         <span class="bold"><strong>typename</strong></span> Allocator = std::allocator&lt;<span class="bold"><strong>void</strong></span>&gt; &gt; 
34<span class="bold"><strong>class</strong></span> functionN : <span class="bold"><strong>public</strong></span> <a href="function_base.html" title="Class function_base">function_base</a> {
35<span class="bold"><strong>public</strong></span>:
36  <span class="emphasis"><em>// types</em></span>
37  <span class="bold"><strong>typedef</strong></span> R         result_type;         
38  <span class="bold"><strong>typedef</strong></span> Allocator allocator_type;      
39  <span class="bold"><strong>typedef</strong></span> T1        argument_type;         <span class="emphasis"><em>// If N == 1</em></span>
40  <span class="bold"><strong>typedef</strong></span> T1        first_argument_type;   <span class="emphasis"><em>// If N == 2</em></span>
41  <span class="bold"><strong>typedef</strong></span> T2        second_argument_type;  <span class="emphasis"><em>// If N == 2</em></span>
42  <span class="bold"><strong>typedef</strong></span> T1        arg1_type;           
43  <span class="bold"><strong>typedef</strong></span> T2        arg2_type;           
44     .
45     .
46     .
47  <span class="bold"><strong>typedef</strong></span> TN        argN_type;           
48
49  <span class="emphasis"><em>// static constants</em></span>
50  <span class="bold"><strong>static</strong></span> <span class="bold"><strong>const</strong></span> <span class="bold"><strong>int</strong></span> arity = N;
51
52  <span class="emphasis"><em>// <a href="../lambda.html" title="Chapter 8. Boost.Lambda">Lambda</a> library support</em></span>
53  <span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> Args&gt; 
54  <span class="bold"><strong>struct</strong></span> sig {
55    <span class="emphasis"><em>// types</em></span>
56    <span class="bold"><strong>typedef</strong></span> result_type type;
57  };
58
59  <span class="emphasis"><em>// <a href="functionN.html#boost.functionNconstruct-copy-destruct">construct/copy/destruct</a></em></span>
60  <a href="functionN.html#id624366-bb">functionN</a>();
61  <a href="functionN.html#id828680-bb">functionN</a>(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&amp;);
62  <span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> F&gt; <a href="functionN.html#id718435-bb">functionN</a>(F);
63  functionN&amp; <a href="functionN.html#id972653-bb"><span class="bold"><strong>operator</strong></span>=</a>(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&amp;);
64  <a href="functionN.html#id836349-bb">~functionN</a>();
65
66  <span class="emphasis"><em>// <a href="functionN.html#id753718-bb">modifiers</a></em></span>
67  <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="functionN.html#id931560-bb">swap</a>(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&amp;);
68  <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="functionN.html#id760319-bb">clear</a>();
69
70  <span class="emphasis"><em>// <a href="functionN.html#id831266-bb">capacity</a></em></span>
71  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id660662-bb">empty</a>() <span class="bold"><strong>const</strong></span>;
72  <a href="functionN.html#id690857-bb"><span class="bold"><strong>operator</strong></span> safe_bool</a>() <span class="bold"><strong>const</strong></span>;
73  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id654762-bb"><span class="bold"><strong>operator</strong></span>!</a>() <span class="bold"><strong>const</strong></span>;
74
75  <span class="emphasis"><em>// <a href="functionN.html#id698050-bb">target access</a></em></span>
76  <span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> Functor&gt; <span class="type">Functor*</span> <a href="functionN.html#id974115-bb">target</a>();
77  <span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> Functor&gt; <span class="type"><span class="bold"><strong>const</strong></span> Functor*</span> <a href="functionN.html#id966434-bb">target</a>() <span class="bold"><strong>const</strong></span>;
78  <span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> Functor&gt; <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id629091-bb">contains</a>(<span class="bold"><strong>const</strong></span> Functor&amp;) <span class="bold"><strong>const</strong></span>;
79  <span class="type"><span class="bold"><strong>const</strong></span> std::type_info&amp;</span> <a href="functionN.html#id821878-bb">target_type</a>() <span class="bold"><strong>const</strong></span>;
80
81  <span class="emphasis"><em>// <a href="functionN.html#id755020-bb">invocation</a></em></span>
82  <span class="type">result_type</span> <a href="functionN.html#id755023-bb"><span class="bold"><strong>operator</strong></span>()</a>(arg1_type, arg2_type, ..., argN_type) <span class="bold"><strong>const</strong></span>;
83};
84
85<span class="emphasis"><em>// <a href="functionN.html#id660595-bb">specialized algorithms</a></em></span>
86<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator&gt; 
87  <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="functionN.html#id830916-bb">swap</a>(<a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp;,
88            <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp;);
89
90<span class="emphasis"><em>// <a href="functionN.html#id658742-bb">comparison operators</a></em></span>
91<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
92         <span class="bold"><strong>typename</strong></span> Functor&gt; 
93  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id694161-bb"><span class="bold"><strong>operator</strong></span>==</a>(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp;, Functor);
94<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
95         <span class="bold"><strong>typename</strong></span> Functor&gt; 
96  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id649224-bb"><span class="bold"><strong>operator</strong></span>==</a>(Functor, <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp;);
97<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
98         <span class="bold"><strong>typename</strong></span> Functor&gt; 
99  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id663663-bb"><span class="bold"><strong>operator</strong></span>==</a>(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp;,
100                  <a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;Functor&gt;);
101<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
102         <span class="bold"><strong>typename</strong></span> Functor&gt; 
103  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id856748-bb"><span class="bold"><strong>operator</strong></span>==</a>(<a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;Functor&gt;,
104                  <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp;);
105<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator1,
106         <span class="bold"><strong>typename</strong></span> U1, <span class="bold"><strong>typename</strong></span> U2, ..., <span class="bold"><strong>typename</strong></span> UN, <span class="bold"><strong>typename</strong></span> Allocator2&gt; 
107  <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="functionN.html#id687298-bb"><span class="bold"><strong>operator</strong></span>==</a>(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator1&gt;&amp;,
108                  <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;U1, U2, ..., UN, Allocator2&gt;&amp;);
109<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
110         <span class="bold"><strong>typename</strong></span> Functor&gt; 
111  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id660679-bb"><span class="bold"><strong>operator</strong></span>!=</a>(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp;, Functor);
112<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
113         <span class="bold"><strong>typename</strong></span> Functor&gt; 
114  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id682340-bb"><span class="bold"><strong>operator</strong></span>!=</a>(Functor, <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp;);
115<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
116         <span class="bold"><strong>typename</strong></span> Functor&gt; 
117  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id628406-bb"><span class="bold"><strong>operator</strong></span>!=</a>(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp;,
118                  <a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;Functor&gt;);
119<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
120         <span class="bold"><strong>typename</strong></span> Functor&gt; 
121  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id792057-bb"><span class="bold"><strong>operator</strong></span>!=</a>(<a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;Functor&gt;,
122                  <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp;);
123<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator1,
124         <span class="bold"><strong>typename</strong></span> U1, <span class="bold"><strong>typename</strong></span> U2, ..., <span class="bold"><strong>typename</strong></span> UN, <span class="bold"><strong>typename</strong></span> Allocator2&gt; 
125  <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="functionN.html#id834428-bb"><span class="bold"><strong>operator</strong></span>!=</a>(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator1&gt;&amp;,
126                  <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;U1, U2, ..., UN, Allocator2&gt;&amp;);</pre></div>
127<div class="refsect1" lang="en">
128<a name="id1208938"></a><h2>Description</h2>
129<p>Class template <a href="functionN.html" title="Class template functionN">functionN</a> is
130      actually a family of related classes <a href="functionN.html" title="Class template functionN">function0</a>, <a href="functionN.html" title="Class template functionN">function1</a>, etc., up to some
131      implementation-defined maximum. In this context, <code class="computeroutput">N</code>
132      refers to the number of parameters.</p>
133<div class="refsect2" lang="en">
134<a name="id1208974"></a><h3>
135<a name="boost.functionNconstruct-copy-destruct"></a><code class="computeroutput">functionN</code> construct/copy/destruct</h3>
136<div class="orderedlist"><ol type="1">
137<li>
138<pre class="literallayout"><a name="id624366-bb"></a>functionN();</pre>
139<div class="variablelist"><table border="0">
140<col align="left" valign="top">
141<tbody>
142<tr>
143<td>
144<span class="term">Postconditions:</span></td>
145<td><code class="computeroutput">this-&gt;<a href="functionN.html#id660662-bb">empty</a>()</code></td>
146</tr>
147<tr>
148<td>
149<span class="term">Throws:</span></td>
150<td>Will not throw.</td>
151</tr>
152</tbody>
153</table></div>
154</li>
155<li>
156<pre class="literallayout"><a name="id828680-bb"></a>functionN(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&amp; f);</pre>
157<div class="variablelist"><table border="0">
158<col align="left" valign="top">
159<tbody>
160<tr>
161<td>
162<span class="term">Postconditions:</span></td>
163<td>Contains a copy of the <code class="computeroutput">f</code>'s target, if it has one, or is empty if <code class="computeroutput">f.<a href="functionN.html#id660662-bb">empty</a>()</code>.</td>
164</tr>
165<tr>
166<td>
167<span class="term">Throws:</span></td>
168<td>Will not throw unless copying the target of <code class="computeroutput">f</code> throws.</td>
169</tr>
170</tbody>
171</table></div>
172</li>
173<li>
174<pre class="literallayout"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> F&gt; <a name="id718435-bb"></a>functionN(F f);</pre>
175<div class="variablelist"><table border="0">
176<col align="left" valign="top">
177<tbody>
178<tr>
179<td>
180<span class="term">Requires:</span></td>
181<td>F is a function object Callable from <code class="computeroutput">this</code>.</td>
182</tr>
183<tr>
184<td>
185<span class="term">Postconditions:</span></td>
186<td>
187<code class="computeroutput">*this</code> targets a copy of <code class="computeroutput">f</code> if <code class="computeroutput">f</code> is nonempty, or <code class="computeroutput">this-&gt;<a href="functionN.html#id660662-bb">empty</a>()</code> if <code class="computeroutput">f</code> is empty.</td>
188</tr>
189</tbody>
190</table></div>
191</li>
192<li>
193<pre class="literallayout">functionN&amp; <a name="id972653-bb"></a><span class="bold"><strong>operator</strong></span>=(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&amp; f);</pre>
194<div class="variablelist"><table border="0">
195<col align="left" valign="top">
196<tbody><tr>
197<td>
198<span class="term">Postconditions:</span></td>
199<td>If copy construction does not throw, <code class="computeroutput">*this</code> targets a copy of <code class="computeroutput">f</code>'s target, if it has one, or is empty if <code class="computeroutput">f.<a href="functionN.html#id660662-bb">empty</a>()</code>. If copy construction does throw, <code class="computeroutput">this-&gt;<a href="functionN.html#id660662-bb">empty</a>()</code>.</td>
200</tr></tbody>
201</table></div>
202</li>
203<li>
204<pre class="literallayout"><a name="id836349-bb"></a>~functionN();</pre>
205<div class="variablelist"><table border="0">
206<col align="left" valign="top">
207<tbody><tr>
208<td>
209<span class="term">Effects:</span></td>
210<td>If <code class="computeroutput">!this-&gt;<a href="functionN.html#id660662-bb">empty</a>()</code>, destroys the target of this.</td>
211</tr></tbody>
212</table></div>
213</li>
214</ol></div>
215</div>
216<div class="refsect2" lang="en">
217<a name="id1209306"></a><h3>
218<a name="id753718-bb"></a><code class="computeroutput">functionN</code> modifiers</h3>
219<div class="orderedlist"><ol type="1">
220<li>
221<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id931560-bb"></a>swap(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&amp; f);</pre>
222<div class="variablelist"><table border="0">
223<col align="left" valign="top">
224<tbody><tr>
225<td>
226<span class="term">Effects:</span></td>
227<td>Interchanges the targets of <code class="computeroutput">*this</code> and <code class="computeroutput">f</code>.</td>
228</tr></tbody>
229</table></div>
230</li>
231<li>
232<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id760319-bb"></a>clear();</pre>
233<div class="variablelist"><table border="0">
234<col align="left" valign="top">
235<tbody><tr>
236<td>
237<span class="term">Postconditions:</span></td>
238<td>this-&gt;<a href="functionN.html#id660662-bb">empty</a>()</td>
239</tr></tbody>
240</table></div>
241</li>
242</ol></div>
243</div>
244<div class="refsect2" lang="en">
245<a name="id1209418"></a><h3>
246<a name="id831266-bb"></a><code class="computeroutput">functionN</code> capacity</h3>
247<div class="orderedlist"><ol type="1">
248<li>
249<pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id660662-bb"></a>empty() <span class="bold"><strong>const</strong></span>;</pre>
250<div class="variablelist"><table border="0">
251<col align="left" valign="top">
252<tbody>
253<tr>
254<td>
255<span class="term">Returns:</span></td>
256<td>
257<code class="computeroutput">false</code> if <code class="computeroutput">this</code> has a target, and <code class="computeroutput">true</code> otherwise.</td>
258</tr>
259<tr>
260<td>
261<span class="term">Throws:</span></td>
262<td>Will not throw.</td>
263</tr>
264</tbody>
265</table></div>
266</li>
267<li>
268<pre class="literallayout"><a name="id690857-bb"></a><span class="bold"><strong>operator</strong></span> safe_bool() <span class="bold"><strong>const</strong></span>;</pre>
269<div class="variablelist"><table border="0">
270<col align="left" valign="top">
271<tbody>
272<tr>
273<td>
274<span class="term">Returns:</span></td>
275<td>A <code class="computeroutput">safe_bool</code> that evaluates <code class="computeroutput">false</code> in a boolean context when <code class="computeroutput">this-&gt;<a href="functionN.html#id660662-bb">empty</a>()</code>, and <code class="computeroutput">true</code> otherwise.</td>
276</tr>
277<tr>
278<td>
279<span class="term">Throws:</span></td>
280<td>Will not throw.</td>
281</tr>
282</tbody>
283</table></div>
284</li>
285<li>
286<pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id654762-bb"></a><span class="bold"><strong>operator</strong></span>!() <span class="bold"><strong>const</strong></span>;</pre>
287<div class="variablelist"><table border="0">
288<col align="left" valign="top">
289<tbody>
290<tr>
291<td>
292<span class="term">Returns:</span></td>
293<td><code class="computeroutput">this-&gt;<a href="functionN.html#id660662-bb">empty</a>()</code></td>
294</tr>
295<tr>
296<td>
297<span class="term">Throws:</span></td>
298<td>Will not throw.</td>
299</tr>
300</tbody>
301</table></div>
302</li>
303</ol></div>
304</div>
305<div class="refsect2" lang="en">
306<a name="id1209628"></a><h3>
307<a name="id698050-bb"></a><code class="computeroutput">functionN</code> target access</h3>
308<div class="orderedlist"><ol type="1">
309<li>
310<p><a name="id698053-bb"></a></p>
311<pre class="literallayout"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> Functor&gt; <span class="type">Functor*</span> <a name="id974115-bb"></a>target();
312<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> Functor&gt; <span class="type"><span class="bold"><strong>const</strong></span> Functor*</span> <a name="id966434-bb"></a>target() <span class="bold"><strong>const</strong></span>;</pre>
313<div class="variablelist"><table border="0">
314<col align="left" valign="top">
315<tbody>
316<tr>
317<td>
318<span class="term">Returns:</span></td>
319<td>If <code class="computeroutput">this</code> stores a target of type
320        <code class="computeroutput">Functor</code>, returns the address of the
321        target. Otherwise, returns the NULL
322        pointer.</td>
323</tr>
324<tr>
325<td>
326<span class="term">Throws:</span></td>
327<td>Will not throw.</td>
328</tr>
329</tbody>
330</table></div>
331</li>
332<li>
333<pre class="literallayout"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> Functor&gt; <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id629091-bb"></a>contains(<span class="bold"><strong>const</strong></span> Functor&amp; f) <span class="bold"><strong>const</strong></span>;</pre>
334<div class="variablelist"><table border="0">
335<col align="left" valign="top">
336<tbody><tr>
337<td>
338<span class="term">Returns:</span></td>
339<td>
340<code class="computeroutput">true</code> if <code class="computeroutput">this-&gt;<a href="functionN.html#id698053-bb">target</a>&lt;Functor&gt;()</code> is non-NULL and <code class="computeroutput"><a href="function_equal.html" title="Function template function_equal">function_equal</a>(*(this-&gt;target&lt;Functor&gt;()), f)</code>
341</td>
342</tr></tbody>
343</table></div>
344</li>
345<li>
346<pre class="literallayout"><span class="type"><span class="bold"><strong>const</strong></span> std::type_info&amp;</span> <a name="id821878-bb"></a>target_type() <span class="bold"><strong>const</strong></span>;</pre>
347<div class="variablelist"><table border="0">
348<col align="left" valign="top">
349<tbody>
350<tr>
351<td>
352<span class="term">Returns:</span></td>
353<td>
354<code class="computeroutput">typeid</code> of the target function object, or <code class="computeroutput">typeid(void)</code> if <code class="computeroutput">this-&gt;<a href="functionN.html#id660662-bb">empty</a>()</code>.</td>
355</tr>
356<tr>
357<td>
358<span class="term">Throws:</span></td>
359<td>Will not throw.</td>
360</tr>
361</tbody>
362</table></div>
363</li>
364</ol></div>
365</div>
366<div class="refsect2" lang="en">
367<a name="id1209896"></a><h3>
368<a name="id755020-bb"></a><code class="computeroutput">functionN</code> invocation</h3>
369<div class="orderedlist"><ol type="1"><li>
370<pre class="literallayout"><span class="type">result_type</span> <a name="id755023-bb"></a><span class="bold"><strong>operator</strong></span>()(arg1_type a1, arg2_type a2, ..., argN_type aN) <span class="bold"><strong>const</strong></span>;</pre>
371<div class="variablelist"><table border="0">
372<col align="left" valign="top">
373<tbody>
374<tr>
375<td>
376<span class="term">Effects:</span></td>
377<td>
378<code class="computeroutput">f(a1, a2, ..., aN)</code>, where <code class="computeroutput">f</code> is the target of <code class="computeroutput">*this</code>.</td>
379</tr>
380<tr>
381<td>
382<span class="term">Returns:</span></td>
383<td>if <code class="computeroutput">R</code> is <code class="computeroutput">void</code>, nothing is returned; otherwise, the return value of the call to <code class="computeroutput">f</code> is returned.</td>
384</tr>
385<tr>
386<td>
387<span class="term">Throws:</span></td>
388<td>
389<code class="computeroutput"><a href="bad_function_call.html" title="Class bad_function_call">bad_function_call</a></code> if <code class="computeroutput">this-&gt;<a href="functionN.html#id660662-bb">empty</a>()</code>. Otherwise, may through any exception thrown by the target function <code class="computeroutput">f</code>.</td>
390</tr>
391</tbody>
392</table></div>
393</li></ol></div>
394</div>
395<div class="refsect2" lang="en">
396<a name="id1210029"></a><h3>
397<a name="id660595-bb"></a><code class="computeroutput">functionN</code> specialized algorithms</h3>
398<div class="orderedlist"><ol type="1"><li>
399<pre class="literallayout"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator&gt; 
400  <span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id830916-bb"></a>swap(<a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp; f1,
401            <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp; f2);</pre>
402<div class="variablelist"><table border="0">
403<col align="left" valign="top">
404<tbody><tr>
405<td>
406<span class="term">Effects:</span></td>
407<td><code class="computeroutput">f1.<a href="functionN.html#id931560-bb">swap</a>(f2)</code></td>
408</tr></tbody>
409</table></div>
410</li></ol></div>
411</div>
412<div class="refsect2" lang="en">
413<a name="id1210137"></a><h3>
414<a name="id658742-bb"></a><code class="computeroutput">functionN</code> comparison operators</h3>
415<div class="orderedlist"><ol type="1">
416<li>
417<p><a name="id694157-bb"></a></p>
418<pre class="literallayout"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
419         <span class="bold"><strong>typename</strong></span> Functor&gt; 
420  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id694161-bb"></a><span class="bold"><strong>operator</strong></span>==(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp; f, Functor g);
421<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
422         <span class="bold"><strong>typename</strong></span> Functor&gt; 
423  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id649224-bb"></a><span class="bold"><strong>operator</strong></span>==(Functor g, <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp; f);
424<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
425         <span class="bold"><strong>typename</strong></span> Functor&gt; 
426  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id663663-bb"></a><span class="bold"><strong>operator</strong></span>==(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp; f,
427                  <a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;Functor&gt; g);
428<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
429         <span class="bold"><strong>typename</strong></span> Functor&gt; 
430  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id856748-bb"></a><span class="bold"><strong>operator</strong></span>==(<a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;Functor&gt; g,
431                  <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp; f);
432<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator1,
433         <span class="bold"><strong>typename</strong></span> U1, <span class="bold"><strong>typename</strong></span> U2, ..., <span class="bold"><strong>typename</strong></span> UN, <span class="bold"><strong>typename</strong></span> Allocator2&gt; 
434  <span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id687298-bb"></a><span class="bold"><strong>operator</strong></span>==(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator1&gt;&amp; f1,
435                  <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;U1, U2, ..., UN, Allocator2&gt;&amp; f2);</pre>
436<div class="variablelist"><table border="0">
437<col align="left" valign="top">
438<tbody>
439<tr>
440<td>
441<span class="term">Returns:</span></td>
442<td>True when <code class="computeroutput">f</code> stores an object of
443        type <code class="computeroutput">Functor</code> and one of the following conditions applies:
444          <div class="itemizedlist"><ul type="disc">
445<li>
446<code class="computeroutput">g</code> is of type
447            <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;Functor&gt;</code>
448            and <code class="computeroutput">f.target&lt;Functor&gt;() == g.<a href="reference_wrapper.html#id623846-bb">get_pointer</a>()</code>.</li>
449<li>
450<code class="computeroutput">g</code> is not of type
451            <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;Functor&gt;</code>
452            and
453            <code class="computeroutput"><a href="function_equal.html" title="Function template function_equal">function_equal</a>(*(f.target&lt;Functor&gt;()),
454            g)</code>.</li>
455</ul></div>
456          </td>
457</tr>
458<tr>
459<td>
460<span class="term">Notes:</span></td>
461<td>
462<code class="computeroutput"><a href="functionN.html" title="Class template functionN">functionN</a></code>
463        objects are not
464        <a href="../EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a>.</td>
465</tr>
466<tr>
467<td>
468<span class="term">Rationale:</span></td>
469<td>The <code class="computeroutput">safe_bool</code> conversion
470        opens a loophole whereby two <code class="computeroutput">functionN</code>
471        instances can be compared via <code class="computeroutput">==</code>, although this
472        is not feasible to implement. The undefined <code class="computeroutput">void
473        operator==</code> closes the loophole and ensures a
474        compile-time or link-time error.</td>
475</tr>
476</tbody>
477</table></div>
478</li>
479<li>
480<p><a name="id786927-bb"></a></p>
481<pre class="literallayout"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
482         <span class="bold"><strong>typename</strong></span> Functor&gt; 
483  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id660679-bb"></a><span class="bold"><strong>operator</strong></span>!=(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp; f, Functor g);
484<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
485         <span class="bold"><strong>typename</strong></span> Functor&gt; 
486  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id682340-bb"></a><span class="bold"><strong>operator</strong></span>!=(Functor g, <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp; f);
487<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
488         <span class="bold"><strong>typename</strong></span> Functor&gt; 
489  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id628406-bb"></a><span class="bold"><strong>operator</strong></span>!=(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp; f,
490                  <a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;Functor&gt; g);
491<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator,
492         <span class="bold"><strong>typename</strong></span> Functor&gt; 
493  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id792057-bb"></a><span class="bold"><strong>operator</strong></span>!=(<a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;Functor&gt; g,
494                  <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator&gt;&amp; f);
495<span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2, ..., <span class="bold"><strong>typename</strong></span> TN, <span class="bold"><strong>typename</strong></span> Allocator1,
496         <span class="bold"><strong>typename</strong></span> U1, <span class="bold"><strong>typename</strong></span> U2, ..., <span class="bold"><strong>typename</strong></span> UN, <span class="bold"><strong>typename</strong></span> Allocator2&gt; 
497  <span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id834428-bb"></a><span class="bold"><strong>operator</strong></span>!=(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;T1, T2, ..., TN, Allocator1&gt;&amp; f1,
498                  <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&lt;U1, U2, ..., UN, Allocator2&gt;&amp; f2);</pre>
499<div class="variablelist"><table border="0">
500<col align="left" valign="top">
501<tbody>
502<tr>
503<td>
504<span class="term">Returns:</span></td>
505<td>True when <code class="computeroutput">f</code> does not store an
506        object of type <code class="computeroutput">Functor</code> or it stores an object of
507        type <code class="computeroutput">Functor</code> and one of the following conditions
508        applies:
509          <div class="itemizedlist"><ul type="disc">
510<li>
511<code class="computeroutput">g</code> is of type
512            <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;Functor&gt;</code>
513            and <code class="computeroutput">f.target&lt;Functor&gt;() != g.<a href="reference_wrapper.html#id623846-bb">get_pointer</a>()</code>.</li>
514<li>
515<code class="computeroutput">g</code> is not of type
516            <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;Functor&gt;</code>
517            and <code class="computeroutput">!<a href="function_equal.html" title="Function template function_equal">function_equal</a>(*(f.target&lt;Functor&gt;()), g)</code>.</li>
518</ul></div>
519          </td>
520</tr>
521<tr>
522<td>
523<span class="term">Notes:</span></td>
524<td>
525<code class="computeroutput"><a href="functionN.html" title="Class template functionN">functionN</a></code>
526        objects are not
527        <a href="../EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a>.</td>
528</tr>
529<tr>
530<td>
531<span class="term">Rationale:</span></td>
532<td>The <code class="computeroutput">safe_bool</code> conversion
533        opens a loophole whereby two <code class="computeroutput">functionN</code>
534        instances can be compared via <code class="computeroutput">!=</code>, although this
535        is not feasible to implement. The undefined <code class="computeroutput">void
536        operator!=</code> closes the loophole and ensures a
537        compile-time or link-time error.</td>
538</tr>
539</tbody>
540</table></div>
541</li>
542</ol></div>
543</div>
544</div>
545</div>
546<table width="100%"><tr>
547<td align="left"></td>
548<td align="right"><small>Copyright © 2001-2004 Douglas Gregor</small></td>
549</tr></table>
550<hr>
551<div class="spirit-nav">
552<a accesskey="p" href="function_base.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../function/reference.html#header.boost.function.hpp"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="function.html"><img src="../images/next.png" alt="Next"></a>
553</div>
554</body>
555</html>
Note: See TracBrowser for help on using the repository browser.