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.69.1"> |
---|
7 | <link rel="start" href="index.html" title="The Boost C++ Libraries"> |
---|
8 | <link rel="up" href="function/reference.html#header.boost.function.hpp" title="Header <boost/function.hpp>"> |
---|
9 | <link rel="prev" href="function_base.html" title="Class function_base"> |
---|
10 | <link rel="next" href="boost/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.png (6897 bytes)" 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="boost/function.html"><img src="images/next.png" alt="Next"></a> |
---|
24 | </div> |
---|
25 | <div class="refentry" lang="en"> |
---|
26 | <a name="functionN"></a><div class="titlepage"></div> |
---|
27 | <div class="refnamediv"> |
---|
28 | <h2><span class="refentrytitle">Class template functionN</span></h2> |
---|
29 | <p>boost::functionN — 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><<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<<span class="bold"><strong>void</strong></span>> > |
---|
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 6. Boost.Lambda">Lambda</a> library support</em></span> |
---|
53 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Args> |
---|
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#functionNconstruct-copy-destruct">construct/copy/destruct</a></em></span> |
---|
60 | <a href="functionN.html#id2380335-bb">functionN</a>(); |
---|
61 | <a href="functionN.html#id2433978-bb">functionN</a>(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&); |
---|
62 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> F> <a href="functionN.html#id2340638-bb">functionN</a>(F); |
---|
63 | functionN& <a href="functionN.html#id2521955-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>&); |
---|
64 | <a href="functionN.html#id2376550-bb">~functionN</a>(); |
---|
65 | |
---|
66 | <span class="emphasis"><em>// <a href="functionN.html#id2350205-bb">modifiers</a></em></span> |
---|
67 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="functionN.html#id2412281-bb">swap</a>(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>&); |
---|
68 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="functionN.html#id2416181-bb">clear</a>(); |
---|
69 | |
---|
70 | <span class="emphasis"><em>// <a href="functionN.html#id2516334-bb">capacity</a></em></span> |
---|
71 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id2516339-bb">empty</a>() <span class="bold"><strong>const</strong></span>; |
---|
72 | <a href="functionN.html#id2371252-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#id2504239-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#id2366257-bb">target access</a></em></span> |
---|
76 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Functor> <span class="type">Functor*</span> <a href="functionN.html#id2469286-bb">target</a>(); |
---|
77 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Functor> <span class="type"><span class="bold"><strong>const</strong></span> Functor*</span> <a href="functionN.html#id2361856-bb">target</a>() <span class="bold"><strong>const</strong></span>; |
---|
78 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Functor> <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id2350915-bb">contains</a>(<span class="bold"><strong>const</strong></span> Functor&) <span class="bold"><strong>const</strong></span>; |
---|
79 | |
---|
80 | <span class="emphasis"><em>// <a href="functionN.html#id2371468-bb">invocation</a></em></span> |
---|
81 | <span class="type">result_type</span> <a href="functionN.html#id2512050-bb"><span class="bold"><strong>operator</strong></span>()</a>(arg1_type, arg2_type, ..., argN_type) <span class="bold"><strong>const</strong></span>; |
---|
82 | }; |
---|
83 | |
---|
84 | <span class="emphasis"><em>// <a href="functionN.html#id2399776-bb">specialized algorithms</a></em></span> |
---|
85 | <span class="bold"><strong>template</strong></span><<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> |
---|
86 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="functionN.html#id2399780">swap</a>(<a href="functionN.html" title="Class template functionN">functionN</a><T1, T2, ..., TN, Allocator>&, |
---|
87 | <a href="functionN.html" title="Class template functionN">functionN</a><T1, T2, ..., TN, Allocator>&); |
---|
88 | |
---|
89 | <span class="emphasis"><em>// <a href="functionN.html#id2513385-bb">comparison operators</a></em></span> |
---|
90 | <span class="bold"><strong>template</strong></span><<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, |
---|
91 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
92 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id2513394-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><T1, T2, ..., TN, Allocator>&, Functor); |
---|
93 | <span class="bold"><strong>template</strong></span><<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, |
---|
94 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
95 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id2443650-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><T1, T2, ..., TN, Allocator>&); |
---|
96 | <span class="bold"><strong>template</strong></span><<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, |
---|
97 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
98 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id2378702-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><T1, T2, ..., TN, Allocator>&, |
---|
99 | <a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor>); |
---|
100 | <span class="bold"><strong>template</strong></span><<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, |
---|
101 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
102 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id2361523-bb"><span class="bold"><strong>operator</strong></span>==</a>(<a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor>, |
---|
103 | <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a><T1, T2, ..., TN, Allocator>&); |
---|
104 | <span class="bold"><strong>template</strong></span><<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, |
---|
105 | <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> |
---|
106 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="functionN.html#id2443717-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><T1, T2, ..., TN, Allocator1>&, |
---|
107 | <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a><U1, U2, ..., UN, Allocator2>&); |
---|
108 | <span class="bold"><strong>template</strong></span><<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, |
---|
109 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
110 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id2376561-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><T1, T2, ..., TN, Allocator>&, Functor); |
---|
111 | <span class="bold"><strong>template</strong></span><<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, |
---|
112 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
113 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id2407091-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><T1, T2, ..., TN, Allocator>&); |
---|
114 | <span class="bold"><strong>template</strong></span><<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, |
---|
115 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
116 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id2526244-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><T1, T2, ..., TN, Allocator>&, |
---|
117 | <a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor>); |
---|
118 | <span class="bold"><strong>template</strong></span><<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, |
---|
119 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
120 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="functionN.html#id2361938-bb"><span class="bold"><strong>operator</strong></span>!=</a>(<a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor>, |
---|
121 | <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a><T1, T2, ..., TN, Allocator>&); |
---|
122 | <span class="bold"><strong>template</strong></span><<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, |
---|
123 | <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> |
---|
124 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="functionN.html#id2434733-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><T1, T2, ..., TN, Allocator1>&, |
---|
125 | <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a><U1, U2, ..., UN, Allocator2>&);</pre></div> |
---|
126 | <div class="refsect1" lang="en"> |
---|
127 | <a name="id2692966"></a><h2>Description</h2> |
---|
128 | <p>Class template <a href="functionN.html" title="Class template functionN">functionN</a> is |
---|
129 | 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 |
---|
130 | implementation-defined maximum. In this context, <code class="computeroutput">N</code> |
---|
131 | refers to the number of parameters.</p> |
---|
132 | <div class="refsect2" lang="en"> |
---|
133 | <a name="id2693000"></a><h3> |
---|
134 | <a name="functionNconstruct-copy-destruct"></a><code class="computeroutput">functionN</code> construct/copy/destruct</h3> |
---|
135 | <div class="orderedlist"><ol type="1"> |
---|
136 | <li> |
---|
137 | <pre class="literallayout"><a name="id2380335-bb"></a>functionN();</pre> |
---|
138 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>: |
---|
139 | |
---|
140 | <code class="computeroutput">this-><a href="functionN.html#id2516339-bb">empty</a>()</code><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
141 | |
---|
142 | Will not throw.</p> |
---|
143 | </li> |
---|
144 | <li> |
---|
145 | <pre class="literallayout"><a name="id2433978-bb"></a>functionN(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>& f);</pre> |
---|
146 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>: |
---|
147 | |
---|
148 | 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#id2516339-bb">empty</a>()</code>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
149 | |
---|
150 | Will not throw unless copying the target of <code class="computeroutput">f</code> throws.</p> |
---|
151 | </li> |
---|
152 | <li> |
---|
153 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> F> <a name="id2340638-bb"></a>functionN(F f);</pre> |
---|
154 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Requires</span></b>: |
---|
155 | |
---|
156 | F is a function object Callable from <code class="computeroutput">this</code>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>: |
---|
157 | |
---|
158 | <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-><a href="functionN.html#id2516339-bb">empty</a>()</code> if <code class="computeroutput">f</code> is empty.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
159 | |
---|
160 | Will not throw when <code class="computeroutput">f</code> is a stateless function object.</p> |
---|
161 | </li> |
---|
162 | <li> |
---|
163 | <pre class="literallayout">functionN& <a name="id2521955-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>& f);</pre> |
---|
164 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>: |
---|
165 | |
---|
166 | <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#id2516339-bb">empty</a>()</code>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
167 | |
---|
168 | Will not throw when the target of <code class="computeroutput">f</code> is a stateless function object or a reference to the function object.</p> |
---|
169 | </li> |
---|
170 | <li> |
---|
171 | <pre class="literallayout"><a name="id2376550-bb"></a>~functionN();</pre> |
---|
172 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>: |
---|
173 | |
---|
174 | If <code class="computeroutput">!this-><a href="functionN.html#id2516339-bb">empty</a>()</code>, destroys the target of this.</p> |
---|
175 | </li> |
---|
176 | </ol></div> |
---|
177 | </div> |
---|
178 | <div class="refsect2" lang="en"> |
---|
179 | <a name="id2693348"></a><h3> |
---|
180 | <a name="id2350205-bb"></a><code class="computeroutput">functionN</code> modifiers</h3> |
---|
181 | <div class="orderedlist"><ol type="1"> |
---|
182 | <li> |
---|
183 | <pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id2412281-bb"></a>swap(<span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a>& f);</pre> |
---|
184 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>: |
---|
185 | |
---|
186 | Interchanges the targets of <code class="computeroutput">*this</code> and <code class="computeroutput">f</code>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
187 | |
---|
188 | Will not throw.</p> |
---|
189 | </li> |
---|
190 | <li> |
---|
191 | <pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id2416181-bb"></a>clear();</pre> |
---|
192 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>: |
---|
193 | |
---|
194 | this-><a href="functionN.html#id2516339-bb">empty</a>()<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
195 | |
---|
196 | Will not throw.</p> |
---|
197 | </li> |
---|
198 | </ol></div> |
---|
199 | </div> |
---|
200 | <div class="refsect2" lang="en"> |
---|
201 | <a name="id2693474"></a><h3> |
---|
202 | <a name="id2516334-bb"></a><code class="computeroutput">functionN</code> capacity</h3> |
---|
203 | <div class="orderedlist"><ol type="1"> |
---|
204 | <li> |
---|
205 | <pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2516339-bb"></a>empty() <span class="bold"><strong>const</strong></span>;</pre> |
---|
206 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>: |
---|
207 | |
---|
208 | <code class="computeroutput">false</code> if <code class="computeroutput">this</code> has a target, and <code class="computeroutput">true</code> otherwise.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
209 | |
---|
210 | Will not throw.</p> |
---|
211 | </li> |
---|
212 | <li> |
---|
213 | <pre class="literallayout"><a name="id2371252-bb"></a><span class="bold"><strong>operator</strong></span> safe_bool() <span class="bold"><strong>const</strong></span>;</pre> |
---|
214 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>: |
---|
215 | |
---|
216 | A <code class="computeroutput">safe_bool</code> that evaluates <code class="computeroutput">false</code> in a boolean context when <code class="computeroutput">this-><a href="functionN.html#id2516339-bb">empty</a>()</code>, and <code class="computeroutput">true</code> otherwise.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
217 | |
---|
218 | Will not throw.</p> |
---|
219 | </li> |
---|
220 | <li> |
---|
221 | <pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2504239-bb"></a><span class="bold"><strong>operator</strong></span>!() <span class="bold"><strong>const</strong></span>;</pre> |
---|
222 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>: |
---|
223 | |
---|
224 | <code class="computeroutput">this-><a href="functionN.html#id2516339-bb">empty</a>()</code><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
225 | |
---|
226 | Will not throw.</p> |
---|
227 | </li> |
---|
228 | </ol></div> |
---|
229 | </div> |
---|
230 | <div class="refsect2" lang="en"> |
---|
231 | <a name="id2693684"></a><h3> |
---|
232 | <a name="id2366257-bb"></a><code class="computeroutput">functionN</code> target access</h3> |
---|
233 | <div class="orderedlist"><ol type="1"> |
---|
234 | <li> |
---|
235 | <p><a name="id2366261-bb"></a></p> |
---|
236 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Functor> <span class="type">Functor*</span> <a name="id2469286-bb"></a>target(); |
---|
237 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Functor> <span class="type"><span class="bold"><strong>const</strong></span> Functor*</span> <a name="id2361856-bb"></a>target() <span class="bold"><strong>const</strong></span>;</pre> |
---|
238 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>: |
---|
239 | |
---|
240 | If <code class="computeroutput">this</code> stores a target of type |
---|
241 | <code class="computeroutput">Functor</code>, returns the address of the |
---|
242 | target. Otherwise, returns the NULL |
---|
243 | pointer.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
244 | |
---|
245 | Will not throw.</p> |
---|
246 | </li> |
---|
247 | <li> |
---|
248 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Functor> <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2350915-bb"></a>contains(<span class="bold"><strong>const</strong></span> Functor& f) <span class="bold"><strong>const</strong></span>;</pre> |
---|
249 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>: |
---|
250 | |
---|
251 | <code class="computeroutput">true</code> if <code class="computeroutput">this-><a href="functionN.html#id2366261-bb">target</a><Functor>()</code> is non-NULL and <code class="computeroutput"><a href="function_equal.html" title="Function template function_equal">function_equal</a>(*(this->target<Functor>()), f)</code></p> |
---|
252 | </li> |
---|
253 | </ol></div> |
---|
254 | </div> |
---|
255 | <div class="refsect2" lang="en"> |
---|
256 | <a name="id2693885"></a><h3> |
---|
257 | <a name="id2371468-bb"></a><code class="computeroutput">functionN</code> invocation</h3> |
---|
258 | <div class="orderedlist"><ol type="1"><li> |
---|
259 | <pre class="literallayout"><span class="type">result_type</span> <a name="id2512050-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> |
---|
260 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>: |
---|
261 | |
---|
262 | <code class="computeroutput">f(a1, a2, ..., aN)</code>, where <code class="computeroutput">f</code> is the target of <code class="computeroutput">*this</code>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>: |
---|
263 | |
---|
264 | 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.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
265 | |
---|
266 | <code class="computeroutput"><a href="bad_function_call.html" title="Class bad_function_call">bad_function_call</a></code> if <code class="computeroutput">this-><a href="functionN.html#id2516339-bb">empty</a>()</code>. Otherwise, may through any exception thrown by the target function <code class="computeroutput">f</code>.</p> |
---|
267 | </li></ol></div> |
---|
268 | </div> |
---|
269 | <div class="refsect2" lang="en"> |
---|
270 | <a name="id2694021"></a><h3> |
---|
271 | <a name="id2399776-bb"></a><code class="computeroutput">functionN</code> specialized algorithms</h3> |
---|
272 | <div class="orderedlist"><ol type="1"><li> |
---|
273 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<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> |
---|
274 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id2399780"></a>swap(<a href="functionN.html" title="Class template functionN">functionN</a><T1, T2, ..., TN, Allocator>& f1, |
---|
275 | <a href="functionN.html" title="Class template functionN">functionN</a><T1, T2, ..., TN, Allocator>& f2);</pre> |
---|
276 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>: |
---|
277 | |
---|
278 | <code class="computeroutput">f1.<a href="functionN.html#id2412281-bb">swap</a>(f2)</code><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>: |
---|
279 | |
---|
280 | Will not throw.</p> |
---|
281 | </li></ol></div> |
---|
282 | </div> |
---|
283 | <div class="refsect2" lang="en"> |
---|
284 | <a name="id2694134"></a><h3> |
---|
285 | <a name="id2513385-bb"></a><code class="computeroutput">functionN</code> comparison operators</h3> |
---|
286 | <div class="orderedlist"><ol type="1"> |
---|
287 | <li> |
---|
288 | <p><a name="id2513389"></a></p> |
---|
289 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<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, |
---|
290 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
291 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2513394-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><T1, T2, ..., TN, Allocator>& f, Functor g); |
---|
292 | <span class="bold"><strong>template</strong></span><<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, |
---|
293 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
294 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2443650-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><T1, T2, ..., TN, Allocator>& f); |
---|
295 | <span class="bold"><strong>template</strong></span><<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, |
---|
296 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
297 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2378702-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><T1, T2, ..., TN, Allocator>& f, |
---|
298 | <a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor> g); |
---|
299 | <span class="bold"><strong>template</strong></span><<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, |
---|
300 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
301 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2361523-bb"></a><span class="bold"><strong>operator</strong></span>==(<a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor> g, |
---|
302 | <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a><T1, T2, ..., TN, Allocator>& f); |
---|
303 | <span class="bold"><strong>template</strong></span><<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, |
---|
304 | <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> |
---|
305 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id2443717-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><T1, T2, ..., TN, Allocator1>& f1, |
---|
306 | <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a><U1, U2, ..., UN, Allocator2>& f2);</pre> |
---|
307 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>: |
---|
308 | |
---|
309 | True when <code class="computeroutput">f</code> stores an object of |
---|
310 | type <code class="computeroutput">Functor</code> and one of the following conditions applies: |
---|
311 | <div class="itemizedlist"><ul type="disc"> |
---|
312 | <li> |
---|
313 | <code class="computeroutput">g</code> is of type |
---|
314 | <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor></code> |
---|
315 | and <code class="computeroutput">f.target<Functor>() == g.<a href="reference_wrapper.html#id2490294-bb">get_pointer</a>()</code>.</li> |
---|
316 | <li> |
---|
317 | <code class="computeroutput">g</code> is not of type |
---|
318 | <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor></code> |
---|
319 | and |
---|
320 | <code class="computeroutput"><a href="function_equal.html" title="Function template function_equal">function_equal</a>(*(f.target<Functor>()), |
---|
321 | g)</code>.</li> |
---|
322 | </ul></div><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Notes</span></b>: |
---|
323 | |
---|
324 | <code class="computeroutput"><a href="functionN.html" title="Class template functionN">functionN</a></code> |
---|
325 | objects are not |
---|
326 | <a href="EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Rationale</span></b>: |
---|
327 | |
---|
328 | The <code class="computeroutput">safe_bool</code> conversion |
---|
329 | opens a loophole whereby two <code class="computeroutput">functionN</code> |
---|
330 | instances can be compared via <code class="computeroutput">==</code>, although this |
---|
331 | is not feasible to implement. The undefined <code class="computeroutput">void |
---|
332 | operator==</code> closes the loophole and ensures a |
---|
333 | compile-time or link-time error.</p> |
---|
334 | </li> |
---|
335 | <li> |
---|
336 | <p><a name="id2376556"></a></p> |
---|
337 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<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, |
---|
338 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
339 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2376561-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><T1, T2, ..., TN, Allocator>& f, Functor g); |
---|
340 | <span class="bold"><strong>template</strong></span><<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, |
---|
341 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
342 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2407091-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><T1, T2, ..., TN, Allocator>& f); |
---|
343 | <span class="bold"><strong>template</strong></span><<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, |
---|
344 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
345 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2526244-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><T1, T2, ..., TN, Allocator>& f, |
---|
346 | <a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor> g); |
---|
347 | <span class="bold"><strong>template</strong></span><<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, |
---|
348 | <span class="bold"><strong>typename</strong></span> Functor> |
---|
349 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2361938-bb"></a><span class="bold"><strong>operator</strong></span>!=(<a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor> g, |
---|
350 | <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a><T1, T2, ..., TN, Allocator>& f); |
---|
351 | <span class="bold"><strong>template</strong></span><<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, |
---|
352 | <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> |
---|
353 | <span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id2434733-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><T1, T2, ..., TN, Allocator1>& f1, |
---|
354 | <span class="bold"><strong>const</strong></span> <a href="functionN.html" title="Class template functionN">functionN</a><U1, U2, ..., UN, Allocator2>& f2);</pre> |
---|
355 | <p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>: |
---|
356 | |
---|
357 | True when <code class="computeroutput">f</code> does not store an |
---|
358 | object of type <code class="computeroutput">Functor</code> or it stores an object of |
---|
359 | type <code class="computeroutput">Functor</code> and one of the following conditions |
---|
360 | applies: |
---|
361 | <div class="itemizedlist"><ul type="disc"> |
---|
362 | <li> |
---|
363 | <code class="computeroutput">g</code> is of type |
---|
364 | <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor></code> |
---|
365 | and <code class="computeroutput">f.target<Functor>() != g.<a href="reference_wrapper.html#id2490294-bb">get_pointer</a>()</code>.</li> |
---|
366 | <li> |
---|
367 | <code class="computeroutput">g</code> is not of type |
---|
368 | <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor></code> |
---|
369 | and <code class="computeroutput">!<a href="function_equal.html" title="Function template function_equal">function_equal</a>(*(f.target<Functor>()), g)</code>.</li> |
---|
370 | </ul></div><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Notes</span></b>: |
---|
371 | |
---|
372 | <code class="computeroutput"><a href="functionN.html" title="Class template functionN">functionN</a></code> |
---|
373 | objects are not |
---|
374 | <a href="EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Rationale</span></b>: |
---|
375 | |
---|
376 | The <code class="computeroutput">safe_bool</code> conversion |
---|
377 | opens a loophole whereby two <code class="computeroutput">functionN</code> |
---|
378 | instances can be compared via <code class="computeroutput">!=</code>, although this |
---|
379 | is not feasible to implement. The undefined <code class="computeroutput">void |
---|
380 | operator!=</code> closes the loophole and ensures a |
---|
381 | compile-time or link-time error.</p> |
---|
382 | </li> |
---|
383 | </ol></div> |
---|
384 | </div> |
---|
385 | </div> |
---|
386 | </div> |
---|
387 | <table width="100%"><tr> |
---|
388 | <td align="left"></td> |
---|
389 | <td align="right"><small>Copyright © 2001-2004 Douglas Gregor</small></td> |
---|
390 | </tr></table> |
---|
391 | <hr> |
---|
392 | <div class="spirit-nav"> |
---|
393 | <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="boost/function.html"><img src="images/next.png" alt="Next"></a> |
---|
394 | </div> |
---|
395 | </body> |
---|
396 | </html> |
---|