1 | <?xml version="1.0" encoding="utf-8" ?> |
---|
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
---|
4 | <head> |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
6 | <meta name="generator" content="Docutils 0.3.8: http://docutils.sourceforge.net/" /> |
---|
7 | <title>The Boost Parameter Library Reference Documentation</title> |
---|
8 | <link rel="stylesheet" href="rst.css" type="text/css" /> |
---|
9 | </head> |
---|
10 | <body> |
---|
11 | <div class="document" id="the-boost-parameter-library-reference-documentation"> |
---|
12 | <h1 class="title">The Boost Parameter Library Reference Documentation</h1> |
---|
13 | <p><a class="reference" href="../../../../index.htm"><img alt="Boost" src="../../../../boost.png" /></a></p> |
---|
14 | <table class="docutils field-list" frame="void" rules="none"> |
---|
15 | <col class="field-name" /> |
---|
16 | <col class="field-body" /> |
---|
17 | <tbody valign="top"> |
---|
18 | <tr class="field"><th class="field-name">Authors:</th><td class="field-body">David Abrahams, Daniel Wallin</td> |
---|
19 | </tr> |
---|
20 | <tr class="field"><th class="field-name">Contact:</th><td class="field-body"><a class="reference" href="mailto:dave@boost-consulting.com">dave@boost-consulting.com</a>, <a class="reference" href="mailto:dalwan01@student.umu.se">dalwan01@student.umu.se</a></td> |
---|
21 | </tr> |
---|
22 | <tr class="field"><th class="field-name">organization:</th><td class="field-body"><a class="reference" href="http://www.boost-consulting.com">Boost Consulting</a></td> |
---|
23 | </tr> |
---|
24 | <tr class="field"><th class="field-name">date:</th><td class="field-body">$Date: 2005/07/17 19:53:01 $</td> |
---|
25 | </tr> |
---|
26 | <tr class="field"><th class="field-name">copyright:</th><td class="field-body">Copyright David Abrahams, Daniel Wallin |
---|
27 | 2005. Distributed under the Boost Software License, |
---|
28 | Version 1.0. (See accompanying file LICENSE_1_0.txt |
---|
29 | or copy at <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</td> |
---|
30 | </tr> |
---|
31 | </tbody> |
---|
32 | </table> |
---|
33 | <hr class="docutils" /> |
---|
34 | <div class="contents topic" id="contents"> |
---|
35 | <p class="topic-title first"><a name="contents">Contents</a></p> |
---|
36 | <ul class="auto-toc simple"> |
---|
37 | <li><a class="reference" href="#preliminaries" id="id23" name="id23">1 Preliminaries</a><ul class="auto-toc"> |
---|
38 | <li><a class="reference" href="#namespaces" id="id24" name="id24">1.1 Namespaces</a></li> |
---|
39 | <li><a class="reference" href="#exceptions" id="id25" name="id25">1.2 Exceptions</a></li> |
---|
40 | <li><a class="reference" href="#thread-safety" id="id26" name="id26">1.3 Thread Safety</a></li> |
---|
41 | <li><a class="reference" href="#typography" id="id27" name="id27">1.4 Typography</a></li> |
---|
42 | </ul> |
---|
43 | </li> |
---|
44 | <li><a class="reference" href="#terminology" id="id28" name="id28">2 Terminology</a></li> |
---|
45 | <li><a class="reference" href="#concepts" id="id29" name="id29">3 Concepts</a><ul class="auto-toc"> |
---|
46 | <li><a class="reference" href="#argumentpack" id="id30" name="id30">3.1 <span class="concept">ArgumentPack</span></a></li> |
---|
47 | <li><a class="reference" href="#id4" id="id31" name="id31">3.2 <span class="concept">ParameterSpec</span></a></li> |
---|
48 | </ul> |
---|
49 | </li> |
---|
50 | <li><a class="reference" href="#class-templates" id="id32" name="id32">4 Class Templates</a><ul class="auto-toc"> |
---|
51 | <li><a class="reference" href="#id6" id="id33" name="id33">4.1 <tt class="docutils literal"><span class="pre">keyword</span></tt></a></li> |
---|
52 | <li><a class="reference" href="#parameters" id="id34" name="id34">4.2 <tt class="docutils literal"><span class="pre">parameters</span></tt></a></li> |
---|
53 | <li><a class="reference" href="#optional-required" id="id35" name="id35">4.3 <tt class="docutils literal"><span class="pre">optional</span></tt>, <tt class="docutils literal"><span class="pre">required</span></tt></a></li> |
---|
54 | </ul> |
---|
55 | </li> |
---|
56 | <li><a class="reference" href="#metafunctions" id="id36" name="id36">5 Metafunctions</a><ul class="auto-toc"> |
---|
57 | <li><a class="reference" href="#binding" id="id37" name="id37">5.1 <tt class="docutils literal"><span class="pre">binding</span></tt></a></li> |
---|
58 | <li><a class="reference" href="#lazy-binding" id="id38" name="id38">5.2 <tt class="docutils literal"><span class="pre">lazy_binding</span></tt></a></li> |
---|
59 | </ul> |
---|
60 | </li> |
---|
61 | <li><a class="reference" href="#code-generation-macros" id="id39" name="id39">6 Code Generation Macros</a><ul class="auto-toc"> |
---|
62 | <li><a class="reference" href="#boost-parameter-fun-r-n-l-h-p" id="id40" name="id40">6.1 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUN(r,n,l,h,p)</span></tt></a></li> |
---|
63 | <li><a class="reference" href="#boost-parameter-keyword-n-k" id="id41" name="id41">6.2 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_KEYWORD(n,k)</span></tt></a></li> |
---|
64 | <li><a class="reference" href="#boost-parameter-match-p-a-x" id="id42" name="id42">6.3 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MATCH(p,a,x)</span></tt></a></li> |
---|
65 | </ul> |
---|
66 | </li> |
---|
67 | <li><a class="reference" href="#configuration-macros" id="id43" name="id43">7 Configuration Macros</a><ul class="auto-toc"> |
---|
68 | <li><a class="reference" href="#boost-parameter-max-arity" id="id44" name="id44">7.1 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MAX_ARITY</span></tt></a></li> |
---|
69 | </ul> |
---|
70 | </li> |
---|
71 | <li><a class="reference" href="#tutorial" id="id45" name="id45">8 Tutorial</a></li> |
---|
72 | </ul> |
---|
73 | </div> |
---|
74 | <hr class="docutils" /> |
---|
75 | <div class="section" id="preliminaries"> |
---|
76 | <h1><a class="toc-backref" href="#id23" name="preliminaries">1 Preliminaries</a></h1> |
---|
77 | <p>This section covers some basic information you'll need to know in |
---|
78 | order to understand this reference</p> |
---|
79 | <div class="section" id="namespaces"> |
---|
80 | <h2><a class="toc-backref" href="#id24" name="namespaces">1.1 Namespaces</a></h2> |
---|
81 | <p>In this document, all unqualified identifiers should be assumed to |
---|
82 | be defined in namespace <tt class="docutils literal"><span class="pre">boost::parameter</span></tt> unless otherwise |
---|
83 | specified.</p> |
---|
84 | </div> |
---|
85 | <div class="section" id="exceptions"> |
---|
86 | <h2><a class="toc-backref" href="#id25" name="exceptions">1.2 Exceptions</a></h2> |
---|
87 | <p>No operation described in this document |
---|
88 | throws an exception unless otherwise specified.</p> |
---|
89 | </div> |
---|
90 | <div class="section" id="thread-safety"> |
---|
91 | <h2><a class="toc-backref" href="#id26" name="thread-safety">1.3 Thread Safety</a></h2> |
---|
92 | <p>All components of this library can be used safely from multiple |
---|
93 | threads without synchronization.<a class="footnote-reference" href="#thread" id="id2" name="id2"><sup>1</sup></a></p> |
---|
94 | </div> |
---|
95 | <div class="section" id="typography"> |
---|
96 | <h2><a class="toc-backref" href="#id27" name="typography">1.4 Typography</a></h2> |
---|
97 | <p>Names written in <span class="concept">sans serif type</span> represent <a class="reference" href="../../../../more/generic_programming.html#concept">concepts</a>.</p> |
---|
98 | <p>In code blocks, <em>italic type</em> represents unspecified text that |
---|
99 | satisfies the requirements given in the detailed description that |
---|
100 | follows the code block.</p> |
---|
101 | <p>In a specification of the tokens generated by a macro, <strong>bold |
---|
102 | type</strong> is used to highlight the position of the expanded macro |
---|
103 | argument in the result.</p> |
---|
104 | <p>The special character β represents the value of <a class="reference" href="#boost-parameter-max-arity"><tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MAX_ARITY</span></tt></a>.</p> |
---|
105 | </div> |
---|
106 | </div> |
---|
107 | <hr class="docutils" /> |
---|
108 | <div class="section" id="terminology"> |
---|
109 | <h1><a class="toc-backref" href="#id28" name="terminology">2 Terminology</a></h1> |
---|
110 | <span class="target" id="kw"></span><dl class="docutils"> |
---|
111 | <dt>keyword</dt> |
---|
112 | <dd>The name of a function parameter.</dd> |
---|
113 | </dl> |
---|
114 | <span class="target" id="keyword-tag-type"></span><dl class="docutils"> |
---|
115 | <dt>keyword tag type</dt> |
---|
116 | <dd>A type used to uniquely identify a function parameter. Typically |
---|
117 | its name will be the same as that of the parameter.</dd> |
---|
118 | </dl> |
---|
119 | <span class="target" id="positional"></span><dl class="docutils"> |
---|
120 | <dt>positional argument</dt> |
---|
121 | <dd>An argument passed with no explicit keyword. Its parameter is |
---|
122 | determined in the usual C++ way: by position with respect to a |
---|
123 | parameter list.</dd> |
---|
124 | </dl> |
---|
125 | <span class="target" id="tag-type"></span><dl class="docutils"> |
---|
126 | <dt>tag type</dt> |
---|
127 | <dd>Shorthand for “<a class="reference" href="#keyword-tag-type">keyword tag type</a>.”</dd> |
---|
128 | </dl> |
---|
129 | <span class="target" id="keyword-object"></span><dl class="docutils"> |
---|
130 | <dt>keyword object</dt> |
---|
131 | <dd>An instance of <a class="reference" href="#keyword"><tt class="docutils literal"><span class="pre">keyword</span></tt></a> <tt class="docutils literal"><span class="pre"><T></span></tt> for some <a class="reference" href="#tag-type">tag type</a> <tt class="docutils literal"><span class="pre">T</span></tt>.</dd> |
---|
132 | </dl> |
---|
133 | <span class="target" id="tagged-reference"></span><dl class="docutils"> |
---|
134 | <dt>tagged reference</dt> |
---|
135 | <dd><p class="first">An object whose type is associated with a <a class="reference" href="#keyword-tag-type">keyword tag type</a> (the |
---|
136 | object's <em>keyword</em>), and that holds a reference (to the object's |
---|
137 | <em>value</em>).</p> |
---|
138 | <p class="last">As a shorthand, a “tagged reference to <tt class="docutils literal"><span class="pre">x</span></tt>” means a tagged |
---|
139 | reference whose <em>value</em> is <tt class="docutils literal"><span class="pre">x</span></tt>.</p> |
---|
140 | </dd> |
---|
141 | </dl> |
---|
142 | <span class="target" id="tagged-default"></span><dl class="docutils"> |
---|
143 | <dt>tagged default </dt> |
---|
144 | <dd>A <a class="reference" href="#tagged-reference">tagged reference</a> whose <em>value</em> represents the value of a |
---|
145 | default argument.</dd> |
---|
146 | </dl> |
---|
147 | <span class="target" id="tagged-lazy-default"></span><dl class="docutils"> |
---|
148 | <dt>tagged lazy default </dt> |
---|
149 | <dd>A <a class="reference" href="#tagged-reference">tagged reference</a> whose <em>value</em>, when invoked with no |
---|
150 | arguments, computes a default argument value.</dd> |
---|
151 | </dl> |
---|
152 | <span class="target" id="intended-argument-type"></span><dl class="docutils"> |
---|
153 | <dt>intended argument type</dt> |
---|
154 | <dd>The <em>intended argument type</em> of a single-element <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> is the |
---|
155 | type of its element's <em>value</em>. The intended argument type of any other |
---|
156 | type <tt class="docutils literal"><span class="pre">X</span></tt> is <tt class="docutils literal"><span class="pre">X</span></tt> itself.</dd> |
---|
157 | </dl> |
---|
158 | <div class="note"> |
---|
159 | <p class="first admonition-title">Note</p> |
---|
160 | <p class="last">In this reference, we will use concept names (and other names) |
---|
161 | to describe both types and objects, depending on context. So |
---|
162 | for example, “an <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a>” can refer to a type that |
---|
163 | models <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <em>or</em> an object of such a type.</p> |
---|
164 | </div> |
---|
165 | </div> |
---|
166 | <hr class="docutils" /> |
---|
167 | <div class="section" id="concepts"> |
---|
168 | <h1><a class="toc-backref" href="#id29" name="concepts">3 Concepts</a></h1> |
---|
169 | <p>This section describes the generic type <a class="reference" href="../../../../more/generic_programming.html#concept">concepts</a> used by the Parameter library.</p> |
---|
170 | <div class="section" id="argumentpack"> |
---|
171 | <h2><a class="toc-backref" href="#id30" name="argumentpack">3.1 <span class="concept">ArgumentPack</span></a></h2> |
---|
172 | <p>An <span class="concept">ArgumentPack</span> is a collection of <a class="reference" href="#tagged-reference">tagged reference</a>s to the |
---|
173 | actual arguments passed to a function.</p> |
---|
174 | <div class="section" id="requirements"> |
---|
175 | <h3><a name="requirements">Requirements</a></h3> |
---|
176 | <p>In the table below,</p> |
---|
177 | <ul class="simple"> |
---|
178 | <li><tt class="docutils literal"><span class="pre">A</span></tt> is a model of <span class="concept">ArgumentPack</span></li> |
---|
179 | <li><tt class="docutils literal"><span class="pre">x</span></tt> is an instance of <tt class="docutils literal"><span class="pre">A</span></tt></li> |
---|
180 | <li><tt class="docutils literal"><span class="pre">u</span></tt> is a <a class="reference" href="#keyword-object">keyword object</a> of type <tt class="docutils literal"><span class="pre">K</span></tt></li> |
---|
181 | <li><tt class="docutils literal"><span class="pre">v</span></tt> is a <a class="reference" href="#tagged-default">tagged default</a> with <a class="reference" href="#tag-type">tag type</a> <tt class="docutils literal"><span class="pre">L</span></tt> and <em>value</em> of type <tt class="docutils literal"><span class="pre">D</span></tt></li> |
---|
182 | <li><tt class="docutils literal"><span class="pre">w</span></tt> is a <a class="reference" href="#tagged-lazy-default">tagged lazy default</a> with <a class="reference" href="#tag-type">tag type</a> <tt class="docutils literal"><span class="pre">M</span></tt> and <em>value</em> of type <tt class="docutils literal"><span class="pre">E</span> <span class="pre">const</span></tt></li> |
---|
183 | <li><tt class="docutils literal"><span class="pre">z</span></tt> is an <span class="concept">ArgumentPack</span> containing a single element (as created by <a class="reference" href="#keyword"><tt class="docutils literal"><span class="pre">keyword</span></tt></a><tt class="docutils literal"><span class="pre"><…>::operator=</span></tt>)</li> |
---|
184 | </ul> |
---|
185 | <p>Any exceptions are thrown from the invocation of <tt class="docutils literal"><span class="pre">w</span></tt>'s <em>value</em> |
---|
186 | will be propagated to the caller.</p> |
---|
187 | <table border="1" class="docutils"> |
---|
188 | <caption><span class="concept">ArgumentPack</span> requirements</caption> |
---|
189 | <colgroup> |
---|
190 | <col width="11%" /> |
---|
191 | <col width="31%" /> |
---|
192 | <col width="19%" /> |
---|
193 | <col width="40%" /> |
---|
194 | </colgroup> |
---|
195 | <thead valign="bottom"> |
---|
196 | <tr><th>Expression</th> |
---|
197 | <th>Type</th> |
---|
198 | <th>Requirements</th> |
---|
199 | <th>Semantics/Notes</th> |
---|
200 | </tr> |
---|
201 | </thead> |
---|
202 | <tbody valign="top"> |
---|
203 | <tr><td><tt class="docutils literal"><span class="pre">x[u]</span></tt></td> |
---|
204 | <td><tt class="docutils literal"><span class="pre">binding<A,K>::type</span></tt></td> |
---|
205 | <td><tt class="docutils literal"><span class="pre">x</span></tt> contains an |
---|
206 | element <em>b</em> whose |
---|
207 | <a class="reference" href="#kw">keyword</a> is <tt class="docutils literal"><span class="pre">K</span></tt></td> |
---|
208 | <td>Returns <em>b</em>'s <em>value</em> (by |
---|
209 | reference).</td> |
---|
210 | </tr> |
---|
211 | <tr><td><tt class="docutils literal"><span class="pre">x[u]</span></tt></td> |
---|
212 | <td><tt class="docutils literal"><span class="pre">binding<A,L,D>::type</span></tt></td> |
---|
213 | <td><em>none</em></td> |
---|
214 | <td>If <tt class="docutils literal"><span class="pre">x</span></tt> contains an element <em>b</em> whose |
---|
215 | <a class="reference" href="#kw">keyword</a> is the same as <tt class="docutils literal"><span class="pre">u</span></tt>'s, |
---|
216 | returns <em>b</em>'s <em>value</em> (by |
---|
217 | reference). Otherwise, returns <tt class="docutils literal"><span class="pre">u</span></tt>'s <em>value</em>.</td> |
---|
218 | </tr> |
---|
219 | <tr><td><tt class="docutils literal"><span class="pre">x[w]</span></tt></td> |
---|
220 | <td><tt class="docutils literal"><span class="pre">lazy_binding<A,M,E>::type</span></tt></td> |
---|
221 | <td><em>none</em></td> |
---|
222 | <td>If <tt class="docutils literal"><span class="pre">x</span></tt> contains an element <em>b</em> whose |
---|
223 | <a class="reference" href="#kw">keyword</a> is the same as <tt class="docutils literal"><span class="pre">w</span></tt>'s, |
---|
224 | returns <em>b</em>'s <em>value</em> (by |
---|
225 | reference). Otherwise, invokes <tt class="docutils literal"><span class="pre">w</span></tt>'s <em>value</em> and returns the result.</td> |
---|
226 | </tr> |
---|
227 | <tr><td><tt class="docutils literal"><span class="pre">x,</span> <span class="pre">z</span></tt></td> |
---|
228 | <td>Model of <span class="concept">ArgumentPack</span></td> |
---|
229 | <td><em>none</em></td> |
---|
230 | <td>Returns an <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing |
---|
231 | all the elements of both <tt class="docutils literal"><span class="pre">x</span></tt> and |
---|
232 | <tt class="docutils literal"><span class="pre">z</span></tt>.</td> |
---|
233 | </tr> |
---|
234 | </tbody> |
---|
235 | </table> |
---|
236 | </div> |
---|
237 | </div> |
---|
238 | <div class="section" id="id4"> |
---|
239 | <h2><a class="toc-backref" href="#id31" name="id4">3.2 <span class="target" id="parameterspec"></span><span class="concept">ParameterSpec</span></a></h2> |
---|
240 | <p>A <span class="concept">ParameterSpec</span> describes the type requirements for arguments |
---|
241 | corresponding to a given <a class="reference" href="#kw">keyword</a> and indicates whether the argument |
---|
242 | is optional or required. The table below details the allowed forms |
---|
243 | and describes their condition for satisfaction by an actual |
---|
244 | argument type. In each row,</p> |
---|
245 | <span class="target" id="conditions"></span><ul class="simple"> |
---|
246 | <li><tt class="docutils literal"><span class="pre">K</span></tt> is the <span class="concept">ParameterSpec</span>'s <a class="reference" href="#keyword-tag-type">keyword tag type</a></li> |
---|
247 | <li><tt class="docutils literal"><span class="pre">A</span></tt> is an <a class="reference" href="#intended-argument-type">intended argument type</a> associated with <tt class="docutils literal"><span class="pre">K</span></tt>, if any</li> |
---|
248 | <li><tt class="docutils literal"><span class="pre">F</span></tt> is a unary <a class="reference" href="../../../mpl/doc/refmanual/lambda-expression.html">MPL lambda expression</a></li> |
---|
249 | </ul> |
---|
250 | <table border="1" class="docutils"> |
---|
251 | <caption><span class="concept">ParameterSpec</span> allowed forms and conditions of satisfaction</caption> |
---|
252 | <colgroup> |
---|
253 | <col width="32%" /> |
---|
254 | <col width="21%" /> |
---|
255 | <col width="47%" /> |
---|
256 | </colgroup> |
---|
257 | <thead valign="bottom"> |
---|
258 | <tr><th>Type</th> |
---|
259 | <th><tt class="docutils literal"><span class="pre">A</span></tt> required</th> |
---|
260 | <th>Condition <tt class="docutils literal"><span class="pre">A</span></tt> must satisfy</th> |
---|
261 | </tr> |
---|
262 | </thead> |
---|
263 | <tbody valign="top"> |
---|
264 | <tr><td><a class="reference" href="#keyword"><tt class="docutils literal"><span class="pre">keyword</span></tt></a><tt class="docutils literal"><span class="pre"><K></span></tt></td> |
---|
265 | <td>no</td> |
---|
266 | <td><em>n/a</em></td> |
---|
267 | </tr> |
---|
268 | <tr><td><a class="reference" href="#optional"><tt class="docutils literal"><span class="pre">optional</span></tt></a><tt class="docutils literal"><span class="pre"><K,F></span></tt></td> |
---|
269 | <td>no</td> |
---|
270 | <td><tt class="docutils literal"><span class="pre">mpl::apply<F,A>::type::value</span></tt> |
---|
271 | is <tt class="docutils literal"><span class="pre">true</span></tt>.</td> |
---|
272 | </tr> |
---|
273 | <tr><td><a class="reference" href="#required"><tt class="docutils literal"><span class="pre">required</span></tt></a><tt class="docutils literal"><span class="pre"><K,F></span></tt></td> |
---|
274 | <td>yes</td> |
---|
275 | <td><tt class="docutils literal"><span class="pre">mpl::apply<F,A>::type::value</span></tt> |
---|
276 | is <tt class="docutils literal"><span class="pre">true</span></tt>.</td> |
---|
277 | </tr> |
---|
278 | </tbody> |
---|
279 | </table> |
---|
280 | <p>The information in a <span class="concept">ParameterSpec</span> is used to <a class="reference" href="index.html#controlling-overload-resolution">limit</a> the |
---|
281 | arguments that will be matched by <a class="reference" href="index.html#forwarding-functions">forwarding functions</a>.</p> |
---|
282 | </div> |
---|
283 | </div> |
---|
284 | <hr class="docutils" /> |
---|
285 | <div class="section" id="class-templates"> |
---|
286 | <h1><a class="toc-backref" href="#id32" name="class-templates">4 Class Templates</a></h1> |
---|
287 | <div class="section" id="id6"> |
---|
288 | <h2><a class="toc-backref" href="#id33" name="id6">4.1 <span class="target" id="keyword"></span><tt class="docutils literal"><span class="pre">keyword</span></tt></a></h2> |
---|
289 | <p>The type of every <a class="reference" href="#keyword-object">keyword object</a> is a specialization of <tt class="docutils literal"><span class="pre">keyword</span></tt>.</p> |
---|
290 | <table class="docutils field-list" frame="void" rules="none"> |
---|
291 | <col class="field-name" /> |
---|
292 | <col class="field-body" /> |
---|
293 | <tbody valign="top"> |
---|
294 | <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/keyword.hpp">boost/parameter/keyword.hpp</a></td> |
---|
295 | </tr> |
---|
296 | </tbody> |
---|
297 | </table> |
---|
298 | <pre class="literal-block"> |
---|
299 | template <class Tag> |
---|
300 | struct keyword |
---|
301 | { |
---|
302 | template <class T> <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#operator">operator=</a>(T& value) const; |
---|
303 | template <class T> <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#operator">operator=</a>(T const& value) const; |
---|
304 | |
---|
305 | template <class T> <em>tagged default</em> <a class="reference" href="#id8">operator|</a>(T& x) const; |
---|
306 | template <class T> <em>tagged default</em> <a class="reference" href="#id8">operator|</a>(T const& x) const; |
---|
307 | |
---|
308 | template <class F> <em>tagged lazy default</em> <a class="reference" href="#id9">operator||</a>(F const&) const; |
---|
309 | |
---|
310 | static keyword<Tag>& <a class="reference" href="#get">get</a>(); |
---|
311 | }; |
---|
312 | </pre> |
---|
313 | <span class="target" id="operator"></span><dl class="docutils"> |
---|
314 | <dt><tt class="docutils literal"><span class="pre">operator=</span></tt></dt> |
---|
315 | <dd><pre class="first literal-block"> |
---|
316 | template <class T> <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T& value) const; |
---|
317 | template <class T> <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T const& value) const; |
---|
318 | </pre> |
---|
319 | <table class="last docutils field-list" frame="void" rules="none"> |
---|
320 | <col class="field-name" /> |
---|
321 | <col class="field-body" /> |
---|
322 | <tbody valign="top"> |
---|
323 | <tr class="field"><th class="field-name">Requires:</th><td class="field-body">nothing</td> |
---|
324 | </tr> |
---|
325 | <tr class="field"><th class="field-name">Returns:</th><td class="field-body">an <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing a single <a class="reference" href="#tagged-reference">tagged reference</a> to |
---|
326 | <tt class="docutils literal"><span class="pre">value</span></tt> with <a class="reference" href="#kw">keyword</a> <tt class="docutils literal"><span class="pre">Tag</span></tt></td> |
---|
327 | </tr> |
---|
328 | </tbody> |
---|
329 | </table> |
---|
330 | </dd> |
---|
331 | </dl> |
---|
332 | <span class="target" id="id8"></span><dl class="docutils"> |
---|
333 | <dt><tt class="docutils literal"><span class="pre">operator|</span></tt></dt> |
---|
334 | <dd><pre class="first literal-block"> |
---|
335 | template <class T> <em>tagged default</em> operator|(T& x) const; |
---|
336 | template <class T> <em>tagged default</em> operator|(T const& x) const; |
---|
337 | </pre> |
---|
338 | <table class="last docutils field-list" frame="void" rules="none"> |
---|
339 | <col class="field-name" /> |
---|
340 | <col class="field-body" /> |
---|
341 | <tbody valign="top"> |
---|
342 | <tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference" href="#tagged-default">tagged default</a> with <em>value</em> <tt class="docutils literal"><span class="pre">x</span></tt> and <a class="reference" href="#kw">keyword</a> <tt class="docutils literal"><span class="pre">Tag</span></tt>.</td> |
---|
343 | </tr> |
---|
344 | </tbody> |
---|
345 | </table> |
---|
346 | </dd> |
---|
347 | </dl> |
---|
348 | <span class="target" id="id9"></span><dl class="docutils"> |
---|
349 | <dt><tt class="docutils literal"><span class="pre">operator||</span></tt></dt> |
---|
350 | <dd><pre class="first literal-block"> |
---|
351 | template <class F> <em>tagged lazy default</em> operator||(F const& g) const; |
---|
352 | </pre> |
---|
353 | <table class="last docutils field-list" frame="void" rules="none"> |
---|
354 | <col class="field-name" /> |
---|
355 | <col class="field-body" /> |
---|
356 | <tbody valign="top"> |
---|
357 | <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal"><span class="pre">g()</span></tt> is valid, with type <tt class="docutils literal"><span class="pre">boost::</span></tt><a class="reference" href="../../../utility/utility.htm#result_of"><tt class="docutils literal"><span class="pre">result_of</span></tt></a><tt class="docutils literal"><span class="pre"><F()>::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id10" name="id10"><sup>2</sup></a></td> |
---|
358 | </tr> |
---|
359 | <tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference" href="#tagged-lazy-default">tagged lazy default</a> with <em>value</em> <tt class="docutils literal"><span class="pre">g</span></tt> and <a class="reference" href="#kw">keyword</a> <tt class="docutils literal"><span class="pre">Tag</span></tt>.</td> |
---|
360 | </tr> |
---|
361 | </tbody> |
---|
362 | </table> |
---|
363 | </dd> |
---|
364 | </dl> |
---|
365 | <span class="target" id="get"></span><dl class="docutils"> |
---|
366 | <dt><tt class="docutils literal"><span class="pre">get</span></tt></dt> |
---|
367 | <dd><pre class="first literal-block"> |
---|
368 | static keyword<Tag>& get(); |
---|
369 | </pre> |
---|
370 | <table class="last docutils field-list" frame="void" rules="none"> |
---|
371 | <col class="field-name" /> |
---|
372 | <col class="field-body" /> |
---|
373 | <tbody valign="top"> |
---|
374 | <tr class="field"><th class="field-name">Returns:</th><td class="field-body">a “singleton instance”: the same object will be |
---|
375 | returned on each invocation of <tt class="docutils literal"><span class="pre">get()</span></tt>.</td> |
---|
376 | </tr> |
---|
377 | <tr class="field"><th class="field-name">Thread Safety:</th><td class="field-body"><tt class="docutils literal"><span class="pre">get()</span></tt> can be called from multiple threads |
---|
378 | simultaneously.</td> |
---|
379 | </tr> |
---|
380 | </tbody> |
---|
381 | </table> |
---|
382 | </dd> |
---|
383 | </dl> |
---|
384 | </div> |
---|
385 | <div class="section" id="parameters"> |
---|
386 | <h2><a class="toc-backref" href="#id34" name="parameters">4.2 <tt class="docutils literal"><span class="pre">parameters</span></tt></a></h2> |
---|
387 | <p>Provides an interface for assembling the actual arguments to a |
---|
388 | <cite>forwarding function</cite> into an <span class="concept">ArgumentPack</span>, in which any |
---|
389 | <a class="reference" href="#positional">positional</a> arguments will be tagged according to the |
---|
390 | corresponding template argument to <tt class="docutils literal"><span class="pre">parameters</span></tt>.</p> |
---|
391 | <table class="docutils field-list" frame="void" rules="none"> |
---|
392 | <col class="field-name" /> |
---|
393 | <col class="field-body" /> |
---|
394 | <tbody valign="top"> |
---|
395 | <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/parameters.hpp">boost/parameter/parameters.hpp</a></td> |
---|
396 | </tr> |
---|
397 | </tbody> |
---|
398 | </table> |
---|
399 | <pre class="literal-block"> |
---|
400 | template <class P0 = <em>unspecified</em>, class P1 = <em>unspecified</em>, …class Pβ = <em>unspecified</em>> |
---|
401 | struct parameters |
---|
402 | { |
---|
403 | template <class A0, class A1 = <em>unspecified</em>, …class Aβ = <em>unspecified</em>> |
---|
404 | struct <a class="reference" href="#match">match</a> |
---|
405 | { |
---|
406 | typedef … type; |
---|
407 | }; |
---|
408 | |
---|
409 | template <class A0> |
---|
410 | <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id12">operator()</a>(A0 const& a0) const; |
---|
411 | |
---|
412 | template <class A0, class A1> |
---|
413 | <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id12">operator()</a>(A0 const& a0, A1 const& a1) const; <span class="vellipsis"> |
---|
414 | . |
---|
415 | . |
---|
416 | . |
---|
417 | </span> |
---|
418 | template <class A0, class A1, …class Aβ> |
---|
419 | <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id12">operator()</a>(A0 const& a0, A1 const& a1, …Aβ const& aβ) const; |
---|
420 | }; |
---|
421 | </pre> |
---|
422 | <table class="docutils field-list" frame="void" rules="none"> |
---|
423 | <col class="field-name" /> |
---|
424 | <col class="field-body" /> |
---|
425 | <tbody valign="top"> |
---|
426 | <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal"><span class="pre">P0</span></tt>, <tt class="docutils literal"><span class="pre">P1</span></tt>, … <tt class="docutils literal"><span class="pre">P</span></tt>β are models of <a class="reference" href="#parameterspec"><span class="concept">ParameterSpec</span></a>.</td> |
---|
427 | </tr> |
---|
428 | </tbody> |
---|
429 | </table> |
---|
430 | <div class="note"> |
---|
431 | <p class="first admonition-title">Note</p> |
---|
432 | <p>In this section, <tt class="docutils literal"><span class="pre">R</span></tt><em>i</em> and <tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> are defined as |
---|
433 | follows, for any argument type <tt class="docutils literal"><span class="pre">A</span></tt><em>i</em>:</p> |
---|
434 | <blockquote class="last"> |
---|
435 | <div class="line-block"> |
---|
436 | <div class="line"><tt class="docutils literal"><span class="pre">R</span></tt><em>i</em> is <tt class="docutils literal"><span class="pre">A</span></tt><em>i</em>'s <a class="reference" href="#intended-argument-type">intended argument type</a></div> |
---|
437 | <div class="line"><br /></div> |
---|
438 | <div class="line-block"> |
---|
439 | <div class="line">if <tt class="docutils literal"><span class="pre">A</span></tt><em>i</em> is a result type of <tt class="docutils literal"><span class="pre">keyword<T>::</span></tt><a class="reference" href="#operator"><tt class="docutils literal"><span class="pre">operator=</span></tt></a></div> |
---|
440 | <div class="line">then </div> |
---|
441 | <div class="line-block"> |
---|
442 | <div class="line"><tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> is <tt class="docutils literal"><span class="pre">T</span></tt></div> |
---|
443 | </div> |
---|
444 | <div class="line">else </div> |
---|
445 | <div class="line-block"> |
---|
446 | <div class="line"><tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> is <tt class="docutils literal"><span class="pre">P</span></tt><em>i</em>'s <a class="reference" href="#keyword-tag-type">keyword tag type</a>.</div> |
---|
447 | </div> |
---|
448 | </div> |
---|
449 | </div> |
---|
450 | </blockquote> |
---|
451 | </div> |
---|
452 | <span class="target" id="match"></span><dl class="docutils"> |
---|
453 | <dt><tt class="docutils literal"><span class="pre">match</span></tt></dt> |
---|
454 | <dd><p class="first">A <a class="reference" href="../../../mpl/doc/refmanual/metafunction.html"><span class="concept">Metafunction</span></a> used to remove a <a class="reference" href="index.html#forwarding-functions">forwarding function</a> from overload resolution.</p> |
---|
455 | <table class="docutils field-list" frame="void" rules="none"> |
---|
456 | <col class="field-name" /> |
---|
457 | <col class="field-body" /> |
---|
458 | <tbody valign="top"> |
---|
459 | <tr class="field"><th class="field-name">Returns:</th><td class="field-body">if <tt class="docutils literal"><span class="pre">P0</span></tt>, <tt class="docutils literal"><span class="pre">P1</span></tt>, …<tt class="docutils literal"><span class="pre">P</span></tt>β are <em>satisfied</em> (see |
---|
460 | below), then <tt class="docutils literal"><span class="pre">parameters<P0,P1,…Pβ></span></tt>. Otherwise, |
---|
461 | <tt class="docutils literal"><span class="pre">match<A0,A1,…Aβ>::type</span></tt> is not defined.</td> |
---|
462 | </tr> |
---|
463 | </tbody> |
---|
464 | </table> |
---|
465 | <p><tt class="docutils literal"><span class="pre">P0</span></tt>, <tt class="docutils literal"><span class="pre">P1</span></tt>, …<tt class="docutils literal"><span class="pre">P</span></tt>β are <strong>satisfied</strong> if, for |
---|
466 | every <em>j</em> in 0…β, either:</p> |
---|
467 | <ul class="last simple"> |
---|
468 | <li><tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is the <em>unspecified</em> default</li> |
---|
469 | <li><strong>or</strong>, <tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is a specialization of <a class="reference" href="#keyword"><tt class="docutils literal"><span class="pre">keyword</span></tt></a>,</li> |
---|
470 | <li><strong>or</strong>, <tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is <a class="reference" href="#optional"><tt class="docutils literal"><span class="pre">optional</span></tt></a> <tt class="docutils literal"><span class="pre"><X,F></span></tt> and either<ul> |
---|
471 | <li><tt class="docutils literal"><span class="pre">X</span></tt> is not <tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> for any <em>i</em>,</li> |
---|
472 | <li><strong>or</strong> <tt class="docutils literal"><span class="pre">X</span></tt> is some <tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> and <tt class="docutils literal"><span class="pre">mpl::apply<F,R</span></tt><em>i</em><tt class="docutils literal"><span class="pre">>::type::value</span></tt> is <tt class="docutils literal"><span class="pre">true</span></tt></li> |
---|
473 | </ul> |
---|
474 | </li> |
---|
475 | <li><strong>or</strong>, <tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is <a class="reference" href="#required"><tt class="docutils literal"><span class="pre">required</span></tt></a> <tt class="docutils literal"><span class="pre"><X,F></span></tt>, and<ul> |
---|
476 | <li><tt class="docutils literal"><span class="pre">X</span></tt> is some <tt class="docutils literal"><span class="pre">K</span></tt><em>i</em>, <strong>and</strong></li> |
---|
477 | <li><tt class="docutils literal"><span class="pre">mpl::apply<F,R</span></tt><em>i</em><tt class="docutils literal"><span class="pre">>::type::value</span></tt> is <tt class="docutils literal"><span class="pre">true</span></tt></li> |
---|
478 | </ul> |
---|
479 | </li> |
---|
480 | </ul> |
---|
481 | </dd> |
---|
482 | </dl> |
---|
483 | <span class="target" id="id12"></span><dl class="docutils"> |
---|
484 | <dt><tt class="docutils literal"><span class="pre">operator()</span></tt></dt> |
---|
485 | <dd><pre class="first literal-block"> |
---|
486 | template <class A0> <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator()(A0 const& a0) const; <span class="vellipsis"> |
---|
487 | . |
---|
488 | . |
---|
489 | . |
---|
490 | </span> |
---|
491 | template <class A0, …class Aβ> <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id12">operator()</a>(A0 const& a0, …Aβ const& aβ) const; |
---|
492 | </pre> |
---|
493 | <table class="last docutils field-list" frame="void" rules="none"> |
---|
494 | <col class="field-name" /> |
---|
495 | <col class="field-body" /> |
---|
496 | <tbody valign="top"> |
---|
497 | <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing, for each <tt class="docutils literal"><span class="pre">a</span></tt><em>i</em>,</p> |
---|
498 | <ul class="last simple"> |
---|
499 | <li>if <tt class="docutils literal"><span class="pre">a</span></tt><em>i</em>, is a single-element <span class="concept">ArgumentPack</span>, its element</li> |
---|
500 | <li>Otherwise, a <a class="reference" href="#tagged-reference">tagged reference</a> with <a class="reference" href="#kw">keyword</a> <tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> and <em>value</em> <tt class="docutils literal"><span class="pre">a</span></tt><em>i</em></li> |
---|
501 | </ul> |
---|
502 | </td> |
---|
503 | </tr> |
---|
504 | </tbody> |
---|
505 | </table> |
---|
506 | </dd> |
---|
507 | </dl> |
---|
508 | </div> |
---|
509 | <div class="section" id="optional-required"> |
---|
510 | <h2><a class="toc-backref" href="#id35" name="optional-required">4.3 <span class="target" id="required"></span><span class="target" id="optional"></span><tt class="docutils literal"><span class="pre">optional</span></tt>, <tt class="docutils literal"><span class="pre">required</span></tt></a></h2> |
---|
511 | <p>These templates describe the requirements on a function parameter.</p> |
---|
512 | <table class="docutils field-list" frame="void" rules="none"> |
---|
513 | <col class="field-name" /> |
---|
514 | <col class="field-body" /> |
---|
515 | <tbody valign="top"> |
---|
516 | <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/parameters.hpp">boost/parameter/parameters.hpp</a></td> |
---|
517 | </tr> |
---|
518 | </tbody> |
---|
519 | </table> |
---|
520 | <table class="docutils field-list" frame="void" rules="none"> |
---|
521 | <col class="field-name" /> |
---|
522 | <col class="field-body" /> |
---|
523 | <tbody valign="top"> |
---|
524 | <tr class="field"><th class="field-name" colspan="2">Specializations model:</th></tr> |
---|
525 | <tr><td> </td><td class="field-body"><a class="reference" href="#parameterspec"><span class="concept">ParameterSpec</span></a></td> |
---|
526 | </tr> |
---|
527 | </tbody> |
---|
528 | </table> |
---|
529 | <pre class="literal-block"> |
---|
530 | template <class Tag, class Predicate = <em>unspecified</em>> |
---|
531 | struct optional; |
---|
532 | |
---|
533 | template <class Tag, class Predicate = <em>unspecified</em>> |
---|
534 | struct required; |
---|
535 | </pre> |
---|
536 | <p>The default value of <tt class="docutils literal"><span class="pre">Predicate</span></tt> is an unspecified <a class="reference" href="../../../mpl/doc/refmanual/metafunction.html"><span class="concept">Metafunction</span></a> that returns |
---|
537 | <tt class="docutils literal"><span class="pre">mpl::true_</span></tt> for any argument.</p> |
---|
538 | </div> |
---|
539 | </div> |
---|
540 | <hr class="docutils" /> |
---|
541 | <div class="section" id="metafunctions"> |
---|
542 | <h1><a class="toc-backref" href="#id36" name="metafunctions">5 Metafunctions</a></h1> |
---|
543 | <p>A <a class="reference" href="../../../mpl/doc/refmanual/metafunction.html"><span class="concept">Metafunction</span></a> is conceptually a function that operates on, and |
---|
544 | returns, C++ types.</p> |
---|
545 | <div class="section" id="binding"> |
---|
546 | <h2><a class="toc-backref" href="#id37" name="binding">5.1 <tt class="docutils literal"><span class="pre">binding</span></tt></a></h2> |
---|
547 | <p>Returns the result type of indexing an argument pack with a |
---|
548 | <a class="reference" href="#keyword-tag-type">keyword tag type</a> or with a <a class="reference" href="#tagged-default">tagged default</a>.</p> |
---|
549 | <table class="docutils field-list" frame="void" rules="none"> |
---|
550 | <col class="field-name" /> |
---|
551 | <col class="field-body" /> |
---|
552 | <tbody valign="top"> |
---|
553 | <tr class="field"><th class="field-name">Defined n:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/binding.hpp">boost/parameter/binding.hpp</a></td> |
---|
554 | </tr> |
---|
555 | </tbody> |
---|
556 | </table> |
---|
557 | <pre class="literal-block"> |
---|
558 | template <class A, class K, class D = void> |
---|
559 | struct binding |
---|
560 | { |
---|
561 | typedef … type; |
---|
562 | }; |
---|
563 | </pre> |
---|
564 | <table class="docutils field-list" frame="void" rules="none"> |
---|
565 | <col class="field-name" /> |
---|
566 | <col class="field-body" /> |
---|
567 | <tbody valign="top"> |
---|
568 | <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal"><span class="pre">A</span></tt> is a model of <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td> |
---|
569 | </tr> |
---|
570 | <tr class="field"><th class="field-name">Returns:</th><td class="field-body">the reference type of the <a class="reference" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal"><span class="pre">A</span></tt> |
---|
571 | having <a class="reference" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal"><span class="pre">K</span></tt>, if any. If no such <a class="reference" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal"><span class="pre">D</span></tt>.</td> |
---|
572 | </tr> |
---|
573 | </tbody> |
---|
574 | </table> |
---|
575 | </div> |
---|
576 | <div class="section" id="lazy-binding"> |
---|
577 | <h2><a class="toc-backref" href="#id38" name="lazy-binding">5.2 <tt class="docutils literal"><span class="pre">lazy_binding</span></tt></a></h2> |
---|
578 | <p>Returns the result type of indexing an argument pack with a <a class="reference" href="#tagged-lazy-default">tagged lazy default</a>.</p> |
---|
579 | <table class="docutils field-list" frame="void" rules="none"> |
---|
580 | <col class="field-name" /> |
---|
581 | <col class="field-body" /> |
---|
582 | <tbody valign="top"> |
---|
583 | <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/binding.hpp">boost/parameter/binding.hpp</a></td> |
---|
584 | </tr> |
---|
585 | </tbody> |
---|
586 | </table> |
---|
587 | <pre class="literal-block"> |
---|
588 | template <class A, class K, class F> |
---|
589 | struct lazy_binding |
---|
590 | { |
---|
591 | typedef … type; |
---|
592 | }; |
---|
593 | </pre> |
---|
594 | <table class="docutils field-list" frame="void" rules="none"> |
---|
595 | <col class="field-name" /> |
---|
596 | <col class="field-body" /> |
---|
597 | <tbody valign="top"> |
---|
598 | <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal"><span class="pre">A</span></tt> is a model of <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td> |
---|
599 | </tr> |
---|
600 | <tr class="field"><th class="field-name">Returns:</th><td class="field-body">the reference type of the <a class="reference" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal"><span class="pre">A</span></tt> |
---|
601 | having <a class="reference" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal"><span class="pre">K</span></tt>, if any. If no such <a class="reference" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal"><span class="pre">boost::</span></tt><a class="reference" href="../../../utility/utility.htm#result_of"><tt class="docutils literal"><span class="pre">result_of</span></tt></a><tt class="docutils literal"><span class="pre"><F()>::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id16" name="id16"><sup>2</sup></a></td> |
---|
602 | </tr> |
---|
603 | </tbody> |
---|
604 | </table> |
---|
605 | </div> |
---|
606 | </div> |
---|
607 | <hr class="docutils" /> |
---|
608 | <div class="section" id="code-generation-macros"> |
---|
609 | <h1><a class="toc-backref" href="#id39" name="code-generation-macros">6 Code Generation Macros</a></h1> |
---|
610 | <p>Macros in this section can be used to ease the writing of code |
---|
611 | using the Parameter libray by eliminating repetitive boilerplate.</p> |
---|
612 | <div class="section" id="boost-parameter-fun-r-n-l-h-p"> |
---|
613 | <h2><a class="toc-backref" href="#id40" name="boost-parameter-fun-r-n-l-h-p">6.1 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUN(r,n,l,h,p)</span></tt></a></h2> |
---|
614 | <p>Generates a sequence of <a class="reference" href="index.html#forwarding-functions">forwarding function</a> templates named |
---|
615 | <tt class="docutils literal"><span class="pre">n</span></tt>, with arities ranging from <tt class="docutils literal"><span class="pre">l</span></tt> to <tt class="docutils literal"><span class="pre">h</span></tt> , returning <tt class="docutils literal"><span class="pre">r</span></tt>, |
---|
616 | and using <tt class="docutils literal"><span class="pre">p</span></tt> to control overload resolution and assign tags to |
---|
617 | positional arguments.</p> |
---|
618 | <table class="docutils field-list" frame="void" rules="none"> |
---|
619 | <col class="field-name" /> |
---|
620 | <col class="field-body" /> |
---|
621 | <tbody valign="top"> |
---|
622 | <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/macros.hpp">boost/parameter/macros.hpp</a></td> |
---|
623 | </tr> |
---|
624 | </tbody> |
---|
625 | </table> |
---|
626 | <table class="docutils field-list" frame="void" rules="none"> |
---|
627 | <col class="field-name" /> |
---|
628 | <col class="field-body" /> |
---|
629 | <tbody valign="top"> |
---|
630 | <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal"><span class="pre">l</span></tt> and <tt class="docutils literal"><span class="pre">h</span></tt> are nonnegative integer tokens such |
---|
631 | that <tt class="docutils literal"><span class="pre">l</span></tt> < <tt class="docutils literal"><span class="pre">h</span></tt></td> |
---|
632 | </tr> |
---|
633 | </tbody> |
---|
634 | </table> |
---|
635 | <dl class="docutils"> |
---|
636 | <dt>Generates</dt> |
---|
637 | <dd><pre class="first last literal-block"> |
---|
638 | template <class A1, class A2, …class A##<strong>l</strong>> |
---|
639 | r name( |
---|
640 | A1 const& a1, A2 const& a2, …A<strong>l</strong> const& x<strong>l</strong> |
---|
641 | , typename <strong>p</strong>::match<A1,A2,…A<strong>l</strong>>::type p = <strong>p</strong>()) |
---|
642 | { |
---|
643 | return <strong>name</strong>_with_named_params(<strong>p</strong>(x1,x2,…x<strong>l</strong>)); |
---|
644 | } |
---|
645 | |
---|
646 | template <class A1, class A2, …class A<strong>l</strong>, class A##<a class="reference" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)> |
---|
647 | r name( |
---|
648 | A1 const& a1, A2 const& a2, …A<strong>l</strong> const& x<strong>l</strong> |
---|
649 | , A##<a class="reference" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>) const& x##<a class="reference" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>) |
---|
650 | , typename <strong>p</strong>::match<A1,A2,…A<strong>l</strong>,A##<a class="reference" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)>::type p = <strong>p</strong>()) |
---|
651 | { |
---|
652 | return <strong>name</strong>_with_named_params(<strong>p</strong>(x1,x2,…x<strong>l</strong>,x##<a class="reference" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>))); |
---|
653 | } <span class="vellipsis"> |
---|
654 | . |
---|
655 | . |
---|
656 | . |
---|
657 | </span> |
---|
658 | template <class A1, class A2, …class A<strong>h</strong>> |
---|
659 | r name( |
---|
660 | A1 const& a1, A2 const& a2, …A<strong>h</strong> const& x<strong>h</strong> |
---|
661 | , typename <strong>p</strong>::match<A1,A2,…A<strong>h</strong>>::type p = <strong>p</strong>()) |
---|
662 | { |
---|
663 | return <strong>name</strong>_with_named_params(<strong>p</strong>(a1,a2,…a<strong>h</strong>)); |
---|
664 | } |
---|
665 | </pre> |
---|
666 | </dd> |
---|
667 | </dl> |
---|
668 | </div> |
---|
669 | <div class="section" id="boost-parameter-keyword-n-k"> |
---|
670 | <h2><a class="toc-backref" href="#id41" name="boost-parameter-keyword-n-k">6.2 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_KEYWORD(n,k)</span></tt></a></h2> |
---|
671 | <p>Generates the declaration of a <a class="reference" href="#keyword-tag-type">keyword tag type</a> named <tt class="docutils literal"><span class="pre">k</span></tt> in |
---|
672 | namespace <tt class="docutils literal"><span class="pre">n</span></tt>, and a corresponding <a class="reference" href="#keyword-object">keyword object</a> definition in |
---|
673 | the enclosing namespace.</p> |
---|
674 | <table class="docutils field-list" frame="void" rules="none"> |
---|
675 | <col class="field-name" /> |
---|
676 | <col class="field-body" /> |
---|
677 | <tbody valign="top"> |
---|
678 | <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/keyword.hpp">boost/parameter/keyword.hpp</a></td> |
---|
679 | </tr> |
---|
680 | </tbody> |
---|
681 | </table> |
---|
682 | <dl class="docutils"> |
---|
683 | <dt>Generates</dt> |
---|
684 | <dd><pre class="first last literal-block"> |
---|
685 | namespace <strong>n</strong> { struct <strong>k</strong>; } |
---|
686 | namespace { |
---|
687 | boost::parameter::keyword<<em>tag-namespace</em>::<strong>k</strong>>& <strong>k</strong> |
---|
688 | = boost::parameter::keyword<<em>tag-namespace</em>::<strong>k</strong>>::get(); |
---|
689 | } |
---|
690 | </pre> |
---|
691 | </dd> |
---|
692 | </dl> |
---|
693 | </div> |
---|
694 | <div class="section" id="boost-parameter-match-p-a-x"> |
---|
695 | <h2><a class="toc-backref" href="#id42" name="boost-parameter-match-p-a-x">6.3 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MATCH(p,a,x)</span></tt></a></h2> |
---|
696 | <p>Generates a defaulted parameter declaration for a <a class="reference" href="index.html#forwarding-functions">forwarding |
---|
697 | function</a>.</p> |
---|
698 | <table class="docutils field-list" frame="void" rules="none"> |
---|
699 | <col class="field-name" /> |
---|
700 | <col class="field-body" /> |
---|
701 | <tbody valign="top"> |
---|
702 | <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/match.hpp">boost/parameter/match.hpp</a></td> |
---|
703 | </tr> |
---|
704 | </tbody> |
---|
705 | </table> |
---|
706 | <table class="docutils field-list" frame="void" rules="none"> |
---|
707 | <col class="field-name" /> |
---|
708 | <col class="field-body" /> |
---|
709 | <tbody valign="top"> |
---|
710 | <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal"><span class="pre">a</span></tt> is a <a class="reference" href="http://www.boost.org/libs/preprocessor/doc/data.html">Boost.Preprocessor sequence</a> |
---|
711 | of the form</p> |
---|
712 | <pre class="last literal-block"> |
---|
713 | (A0)(A1)…(A<em>n</em>) |
---|
714 | </pre> |
---|
715 | </td> |
---|
716 | </tr> |
---|
717 | </tbody> |
---|
718 | </table> |
---|
719 | <dl class="docutils"> |
---|
720 | <dt>Generates</dt> |
---|
721 | <dd><pre class="first last literal-block"> |
---|
722 | typename <strong>p</strong>::match<<strong>A0</strong>,<strong>A1</strong>…,<strong>A</strong><em>n</em>>::type <strong>x</strong> = <strong>p</strong>() |
---|
723 | </pre> |
---|
724 | </dd> |
---|
725 | </dl> |
---|
726 | </div> |
---|
727 | </div> |
---|
728 | <div class="section" id="configuration-macros"> |
---|
729 | <h1><a class="toc-backref" href="#id43" name="configuration-macros">7 Configuration Macros</a></h1> |
---|
730 | <div class="section" id="boost-parameter-max-arity"> |
---|
731 | <h2><a class="toc-backref" href="#id44" name="boost-parameter-max-arity">7.1 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MAX_ARITY</span></tt></a></h2> |
---|
732 | <p>Determines the maximum number of arguments supported by the |
---|
733 | library. Will only be <tt class="docutils literal"><span class="pre">#defined</span></tt> by the library if it is not |
---|
734 | already <tt class="docutils literal"><span class="pre">#defined</span></tt>.</p> |
---|
735 | <table class="docutils field-list" frame="void" rules="none"> |
---|
736 | <col class="field-name" /> |
---|
737 | <col class="field-body" /> |
---|
738 | <tbody valign="top"> |
---|
739 | <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/config.hpp">boost/parameter/config.hpp</a></td> |
---|
740 | </tr> |
---|
741 | </tbody> |
---|
742 | </table> |
---|
743 | <table class="docutils field-list" frame="void" rules="none"> |
---|
744 | <col class="field-name" /> |
---|
745 | <col class="field-body" /> |
---|
746 | <tbody valign="top"> |
---|
747 | <tr class="field"><th class="field-name">Default Value:</th><td class="field-body"><tt class="docutils literal"><span class="pre">5</span></tt></td> |
---|
748 | </tr> |
---|
749 | </tbody> |
---|
750 | </table> |
---|
751 | </div> |
---|
752 | </div> |
---|
753 | <div class="section" id="tutorial"> |
---|
754 | <h1><a class="toc-backref" href="#id45" name="tutorial">8 Tutorial</a></h1> |
---|
755 | <p>Follow <a class="reference" href="index.html#tutorial">this link</a> to the Boost.Parameter tutorial |
---|
756 | documentation.</p> |
---|
757 | <hr class="docutils" /> |
---|
758 | <table class="docutils footnote" frame="void" id="thread" rules="none"> |
---|
759 | <colgroup><col class="label" /><col /></colgroup> |
---|
760 | <tbody valign="top"> |
---|
761 | <tr><td class="label"><a class="fn-backref" href="#id2" name="thread">[1]</a></td><td>References to tag objects may be initialized multiple |
---|
762 | times. This scenario can only occur in the presence of |
---|
763 | threading. Because the C++ standard doesn't consider threading, |
---|
764 | it doesn't explicitly allow or forbid multiple initialization of |
---|
765 | references. That said, it's hard to imagine an implementation |
---|
766 | where it could make a difference.</td></tr> |
---|
767 | </tbody> |
---|
768 | </table> |
---|
769 | <table class="docutils footnote" frame="void" id="no-result-of" rules="none"> |
---|
770 | <colgroup><col class="label" /><col /></colgroup> |
---|
771 | <tbody valign="top"> |
---|
772 | <tr><td class="label"><a name="no-result-of">[2]</a></td><td><em>(<a class="fn-backref" href="#id10">1</a>, <a class="fn-backref" href="#id16">2</a>)</em> Where <a class="reference" href="../../../utility/utility.htm#BOOST_NO_RESULT_OF"><tt class="docutils literal"><span class="pre">BOOST_NO_RESULT_OF</span></tt></a> is <tt class="docutils literal"><span class="pre">#defined</span></tt>, |
---|
773 | <tt class="docutils literal"><span class="pre">boost::</span></tt><a class="reference" href="../../../utility/utility.htm#result_of"><tt class="docutils literal"><span class="pre">result_of</span></tt></a><tt class="docutils literal"><span class="pre"><F()>::type</span></tt> is replaced by |
---|
774 | <tt class="docutils literal"><span class="pre">F::result_type</span></tt>.</td></tr> |
---|
775 | </tbody> |
---|
776 | </table> |
---|
777 | </div> |
---|
778 | </div> |
---|
779 | <hr class="docutils footer" /> |
---|
780 | <div class="footer"> |
---|
781 | Generated on: 2005-08-05 14:58 UTC. |
---|
782 | Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. |
---|
783 | </div> |
---|
784 | </body> |
---|
785 | </html> |
---|