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.5: http://docutils.sourceforge.net/" /> |
---|
7 | <title>The Boost Parameter Library Reference Documentation</title> |
---|
8 | <meta name="authors" content="David Abrahams Daniel Wallin" /> |
---|
9 | <meta name="organization" content="Boost Consulting" /> |
---|
10 | <meta name="date" content="2005-07-17" /> |
---|
11 | <meta name="copyright" content="Copyright David Abrahams, Daniel Wallin 2005. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)" /> |
---|
12 | <link rel="stylesheet" href="rst.css" type="text/css" /> |
---|
13 | </head> |
---|
14 | <body> |
---|
15 | <div class="document" id="the-boost-parameter-library-reference-documentation"> |
---|
16 | <h1 class="title">The Boost Parameter Library Reference Documentation</h1> |
---|
17 | <table class="docinfo" frame="void" rules="none"> |
---|
18 | <col class="docinfo-name" /> |
---|
19 | <col class="docinfo-content" /> |
---|
20 | <tbody valign="top"> |
---|
21 | <tr><th class="docinfo-name">Authors:</th> |
---|
22 | <td>David Abrahams |
---|
23 | <br />Daniel Wallin</td></tr> |
---|
24 | <tr><th class="docinfo-name">Contact:</th> |
---|
25 | <td><a class="first reference" href="mailto:dave@boost-consulting.com">dave@boost-consulting.com</a>, <a class="last reference" href="mailto:dalwan01@student.umu.se">dalwan01@student.umu.se</a></td></tr> |
---|
26 | <tr><th class="docinfo-name">Organization:</th> |
---|
27 | <td><a class="first last reference" href="http://www.boost-consulting.com">Boost Consulting</a></td></tr> |
---|
28 | <tr><th class="docinfo-name">Date:</th> |
---|
29 | <td>2005-07-17</td></tr> |
---|
30 | <tr><th class="docinfo-name">Copyright:</th> |
---|
31 | <td>Copyright David Abrahams, Daniel Wallin |
---|
32 | 2005. Distributed under the Boost Software License, |
---|
33 | Version 1.0. (See accompanying file LICENSE_1_0.txt |
---|
34 | 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></tr> |
---|
35 | </tbody> |
---|
36 | </table> |
---|
37 | <p><a class="reference" href="../../../../index.htm"><img alt="Boost" src="../../../../boost.png" /></a></p> |
---|
38 | <hr class="docutils" /> |
---|
39 | <div class="contents topic"> |
---|
40 | <p class="topic-title first"><a id="contents" name="contents">Contents</a></p> |
---|
41 | <ul class="auto-toc simple"> |
---|
42 | <li><a class="reference" href="#preliminaries" id="id30" name="id30">1 Preliminaries</a><ul class="auto-toc"> |
---|
43 | <li><a class="reference" href="#namespaces" id="id31" name="id31">1.1 Namespaces</a></li> |
---|
44 | <li><a class="reference" href="#exceptions" id="id32" name="id32">1.2 Exceptions</a></li> |
---|
45 | <li><a class="reference" href="#thread-safety" id="id33" name="id33">1.3 Thread Safety</a></li> |
---|
46 | <li><a class="reference" href="#typography" id="id34" name="id34">1.4 Typography</a></li> |
---|
47 | </ul> |
---|
48 | </li> |
---|
49 | <li><a class="reference" href="#terminology" id="id35" name="id35">2 Terminology</a></li> |
---|
50 | <li><a class="reference" href="#concepts" id="id36" name="id36">3 Concepts</a><ul class="auto-toc"> |
---|
51 | <li><a class="reference" href="#argumentpack" id="id37" name="id37">3.1 <span class="concept">ArgumentPack</span></a></li> |
---|
52 | <li><a class="reference" href="#id5" id="id38" name="id38">3.2 <span class="concept">ParameterSpec</span></a></li> |
---|
53 | </ul> |
---|
54 | </li> |
---|
55 | <li><a class="reference" href="#class-templates" id="id39" name="id39">4 Class Templates</a><ul class="auto-toc"> |
---|
56 | <li><a class="reference" href="#id7" id="id40" name="id40">4.1 <tt class="docutils literal"><span class="pre">keyword</span></tt></a></li> |
---|
57 | <li><a class="reference" href="#parameters" id="id41" name="id41">4.2 <tt class="docutils literal"><span class="pre">parameters</span></tt></a></li> |
---|
58 | <li><a class="reference" href="#optional-required" id="id42" name="id42">4.3 <tt class="docutils literal"><span class="pre">optional</span></tt>, <tt class="docutils literal"><span class="pre">required</span></tt></a></li> |
---|
59 | <li><a class="reference" href="#deduced" id="id43" name="id43">4.4 <tt class="docutils literal"><span class="pre">deduced</span></tt></a></li> |
---|
60 | </ul> |
---|
61 | </li> |
---|
62 | <li><a class="reference" href="#metafunctions" id="id44" name="id44">5 Metafunctions</a><ul class="auto-toc"> |
---|
63 | <li><a class="reference" href="#binding" id="id45" name="id45">5.1 <tt class="docutils literal"><span class="pre">binding</span></tt></a></li> |
---|
64 | <li><a class="reference" href="#lazy-binding" id="id46" name="id46">5.2 <tt class="docutils literal"><span class="pre">lazy_binding</span></tt></a></li> |
---|
65 | <li><a class="reference" href="#value-type" id="id47" name="id47">5.3 <tt class="docutils literal"><span class="pre">value_type</span></tt></a></li> |
---|
66 | </ul> |
---|
67 | </li> |
---|
68 | <li><a class="reference" href="#code-generation-macros" id="id48" name="id48">6 Code Generation Macros</a><ul class="auto-toc"> |
---|
69 | <li><a class="reference" href="#boost-parameter-function-result-name-tag-namespace-arguments" id="id49" name="id49">6.1 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></a></li> |
---|
70 | <li><a class="reference" href="#boost-parameter-member-function-result-name-tag-namespace-arguments" id="id50" name="id50">6.2 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MEMBER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></a></li> |
---|
71 | <li><a class="reference" href="#boost-parameter-constructor-cls-impl-tag-namespace-arguments" id="id51" name="id51">6.3 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_CONSTRUCTOR(cls,</span> <span class="pre">impl,</span> <span class="pre">tag_namespace,</span> <span class="pre">arguments)</span></tt></a></li> |
---|
72 | <li><a class="reference" href="#boost-parameter-name-name" id="id52" name="id52">6.4 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_NAME(name)</span></tt></a></li> |
---|
73 | <li><a class="reference" href="#boost-parameter-template-keyword-name" id="id53" name="id53">6.5 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</span></tt></a></li> |
---|
74 | <li><a class="reference" href="#boost-parameter-fun-r-n-l-h-p" id="id54" name="id54">6.6 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUN(r,n,l,h,p)</span></tt></a></li> |
---|
75 | <li><a class="reference" href="#boost-parameter-keyword-n-k" id="id55" name="id55">6.7 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_KEYWORD(n,k)</span></tt></a></li> |
---|
76 | <li><a class="reference" href="#boost-parameter-match-p-a-x" id="id56" name="id56">6.8 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MATCH(p,a,x)</span></tt></a></li> |
---|
77 | </ul> |
---|
78 | </li> |
---|
79 | <li><a class="reference" href="#configuration-macros" id="id57" name="id57">7 Configuration Macros</a><ul class="auto-toc"> |
---|
80 | <li><a class="reference" href="#boost-parameter-max-arity" id="id58" name="id58">7.1 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MAX_ARITY</span></tt></a></li> |
---|
81 | </ul> |
---|
82 | </li> |
---|
83 | <li><a class="reference" href="#tutorial" id="id59" name="id59">8 Tutorial</a></li> |
---|
84 | </ul> |
---|
85 | </div> |
---|
86 | <hr class="docutils" /> |
---|
87 | <div class="section"> |
---|
88 | <h1><a class="toc-backref" href="#id30" id="preliminaries" name="preliminaries">1 Preliminaries</a></h1> |
---|
89 | <p>This section covers some basic information you'll need to know in |
---|
90 | order to understand this reference</p> |
---|
91 | <div class="section"> |
---|
92 | <h2><a class="toc-backref" href="#id31" id="namespaces" name="namespaces">1.1 Namespaces</a></h2> |
---|
93 | <p>In this document, all unqualified identifiers should be assumed to |
---|
94 | be defined in namespace <tt class="docutils literal"><span class="pre">boost::parameter</span></tt> unless otherwise |
---|
95 | specified.</p> |
---|
96 | </div> |
---|
97 | <div class="section"> |
---|
98 | <h2><a class="toc-backref" href="#id32" id="exceptions" name="exceptions">1.2 Exceptions</a></h2> |
---|
99 | <p>No operation described in this document |
---|
100 | throws an exception unless otherwise specified.</p> |
---|
101 | </div> |
---|
102 | <div class="section"> |
---|
103 | <h2><a class="toc-backref" href="#id33" id="thread-safety" name="thread-safety">1.3 Thread Safety</a></h2> |
---|
104 | <p>All components of this library can be used safely from multiple |
---|
105 | threads without synchronization.<a class="footnote-reference" href="#thread" id="id2" name="id2"><sup>1</sup></a></p> |
---|
106 | </div> |
---|
107 | <div class="section"> |
---|
108 | <h2><a class="toc-backref" href="#id34" id="typography" name="typography">1.4 Typography</a></h2> |
---|
109 | <p>Names written in <span class="concept">sans serif type</span> represent <a class="reference" href="../../../../more/generic_programming.html#concept">concepts</a>.</p> |
---|
110 | <p>In code blocks, <em>italic type</em> represents unspecified text that |
---|
111 | satisfies the requirements given in the detailed description that |
---|
112 | follows the code block.</p> |
---|
113 | <p>In a specification of the tokens generated by a macro, <strong>bold |
---|
114 | type</strong> is used to highlight the position of the expanded macro |
---|
115 | argument in the result.</p> |
---|
116 | <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> |
---|
117 | </div> |
---|
118 | </div> |
---|
119 | <hr class="docutils" /> |
---|
120 | <div class="section"> |
---|
121 | <h1><a class="toc-backref" href="#id35" id="terminology" name="terminology">2 Terminology</a></h1> |
---|
122 | <dl class="docutils" id="kw"> |
---|
123 | <dt>keyword</dt> |
---|
124 | <dd>The name of a function parameter.</dd> |
---|
125 | </dl> |
---|
126 | <span class="target" id="keyword-tag-type"></span><dl class="docutils"> |
---|
127 | <dt>keyword tag type</dt> |
---|
128 | <dd>A type used to uniquely identify a function parameter. Typically |
---|
129 | its name will be the same as that of the parameter.</dd> |
---|
130 | </dl> |
---|
131 | <span class="target" id="positional"></span><dl class="docutils"> |
---|
132 | <dt>positional argument</dt> |
---|
133 | <dd>An argument passed with no explicit keyword. Its parameter is |
---|
134 | determined in the usual C++ way: by position with respect to a |
---|
135 | parameter list.</dd> |
---|
136 | </dl> |
---|
137 | <span class="target" id="tag-type"></span><dl class="docutils"> |
---|
138 | <dt>tag type</dt> |
---|
139 | <dd>Shorthand for “<a class="reference" href="#keyword-tag-type">keyword tag type</a>.”</dd> |
---|
140 | </dl> |
---|
141 | <span class="target" id="keyword-object"></span><dl class="docutils"> |
---|
142 | <dt>keyword object</dt> |
---|
143 | <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> |
---|
144 | </dl> |
---|
145 | <span class="target" id="tagged-reference"></span><dl class="docutils"> |
---|
146 | <dt>tagged reference</dt> |
---|
147 | <dd><p class="first">An object whose type is associated with a <a class="reference" href="#keyword-tag-type">keyword tag type</a> (the |
---|
148 | object's <em>keyword</em>), and that holds a reference (to the object's |
---|
149 | <em>value</em>).</p> |
---|
150 | <p class="last">As a shorthand, a “tagged reference to <tt class="docutils literal"><span class="pre">x</span></tt>” means a tagged |
---|
151 | reference whose <em>value</em> is <tt class="docutils literal"><span class="pre">x</span></tt>.</p> |
---|
152 | </dd> |
---|
153 | </dl> |
---|
154 | <span class="target" id="tagged-default"></span><dl class="docutils"> |
---|
155 | <dt>tagged default</dt> |
---|
156 | <dd>A <a class="reference" href="#tagged-reference">tagged reference</a> whose <em>value</em> represents the value of a |
---|
157 | default argument.</dd> |
---|
158 | </dl> |
---|
159 | <span class="target" id="tagged-lazy-default"></span><dl class="docutils"> |
---|
160 | <dt>tagged lazy default</dt> |
---|
161 | <dd>A <a class="reference" href="#tagged-reference">tagged reference</a> whose <em>value</em>, when invoked with no |
---|
162 | arguments, computes a default argument value.</dd> |
---|
163 | </dl> |
---|
164 | <span class="target" id="intended-argument-type"></span><dl class="docutils"> |
---|
165 | <dt>intended argument type</dt> |
---|
166 | <dd>The <em>intended argument type</em> of a single-element <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> is the |
---|
167 | type of its element's <em>value</em>. The intended argument type of any other |
---|
168 | type <tt class="docutils literal"><span class="pre">X</span></tt> is <tt class="docutils literal"><span class="pre">X</span></tt> itself.</dd> |
---|
169 | </dl> |
---|
170 | <div class="note"> |
---|
171 | <p class="first admonition-title">Note</p> |
---|
172 | <p class="last">In this reference, we will use concept names (and other names) |
---|
173 | to describe both types and objects, depending on context. So |
---|
174 | for example, “an <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a>” can refer to a type that |
---|
175 | models <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <em>or</em> an object of such a type.</p> |
---|
176 | </div> |
---|
177 | </div> |
---|
178 | <hr class="docutils" /> |
---|
179 | <div class="section"> |
---|
180 | <h1><a class="toc-backref" href="#id36" id="concepts" name="concepts">3 Concepts</a></h1> |
---|
181 | <p>This section describes the generic type <a class="reference" href="../../../../more/generic_programming.html#concept">concepts</a> used by the Parameter library.</p> |
---|
182 | <div class="section"> |
---|
183 | <h2><a class="toc-backref" href="#id37" id="argumentpack" name="argumentpack">3.1 <span class="concept">ArgumentPack</span></a></h2> |
---|
184 | <p>An <span class="concept">ArgumentPack</span> is a collection of <a class="reference" href="#tagged-reference">tagged reference</a>s to the |
---|
185 | actual arguments passed to a function. Every <span class="concept">ArgumentPack</span> is |
---|
186 | also a valid MPL <a class="reference" href="../../../mpl/doc/refmanual/forward-sequence.html"><span class="concept">Forward Sequence</span></a> consisting of the <a class="reference" href="#keyword-tag-type">keyword tag type</a>s in its <a class="reference" href="#tagged-reference">tagged reference</a>s.</p> |
---|
187 | <div class="section"> |
---|
188 | <h3><a id="requirements" name="requirements">Requirements</a></h3> |
---|
189 | <p>In the table below,</p> |
---|
190 | <ul class="simple"> |
---|
191 | <li><tt class="docutils literal"><span class="pre">A</span></tt> is a model of <span class="concept">ArgumentPack</span></li> |
---|
192 | <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> |
---|
193 | <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> |
---|
194 | <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> |
---|
195 | <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> |
---|
196 | <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> |
---|
197 | </ul> |
---|
198 | <p>Any exceptions are thrown from the invocation of <tt class="docutils literal"><span class="pre">w</span></tt>'s <em>value</em> |
---|
199 | will be propagated to the caller.</p> |
---|
200 | <table border="1" class="docutils"> |
---|
201 | <caption><span class="concept">ArgumentPack</span> requirements</caption> |
---|
202 | <colgroup> |
---|
203 | <col width="11%" /> |
---|
204 | <col width="31%" /> |
---|
205 | <col width="19%" /> |
---|
206 | <col width="40%" /> |
---|
207 | </colgroup> |
---|
208 | <thead valign="bottom"> |
---|
209 | <tr><th class="head">Expression</th> |
---|
210 | <th class="head">Type</th> |
---|
211 | <th class="head">Requirements</th> |
---|
212 | <th class="head">Semantics/Notes</th> |
---|
213 | </tr> |
---|
214 | </thead> |
---|
215 | <tbody valign="top"> |
---|
216 | <tr><td><tt class="docutils literal"><span class="pre">x[u]</span></tt></td> |
---|
217 | <td><tt class="docutils literal"><span class="pre">binding<A,K>::type</span></tt></td> |
---|
218 | <td><tt class="docutils literal"><span class="pre">x</span></tt> contains an |
---|
219 | element <em>b</em> whose |
---|
220 | <a class="reference" href="#kw">keyword</a> is <tt class="docutils literal"><span class="pre">K</span></tt></td> |
---|
221 | <td>Returns <em>b</em>'s <em>value</em> (by |
---|
222 | reference).</td> |
---|
223 | </tr> |
---|
224 | <tr><td><tt class="docutils literal"><span class="pre">x[u]</span></tt></td> |
---|
225 | <td><tt class="docutils literal"><span class="pre">binding<A,L,D>::type</span></tt></td> |
---|
226 | <td><em>none</em></td> |
---|
227 | <td>If <tt class="docutils literal"><span class="pre">x</span></tt> contains an element <em>b</em> whose |
---|
228 | <a class="reference" href="#kw">keyword</a> is the same as <tt class="docutils literal"><span class="pre">u</span></tt>'s, |
---|
229 | returns <em>b</em>'s <em>value</em> (by |
---|
230 | reference). Otherwise, returns <tt class="docutils literal"><span class="pre">u</span></tt>'s <em>value</em>.</td> |
---|
231 | </tr> |
---|
232 | <tr><td><tt class="docutils literal"><span class="pre">x[w]</span></tt></td> |
---|
233 | <td><tt class="docutils literal"><span class="pre">lazy_binding<A,M,E>::type</span></tt></td> |
---|
234 | <td><em>none</em></td> |
---|
235 | <td>If <tt class="docutils literal"><span class="pre">x</span></tt> contains an element <em>b</em> whose |
---|
236 | <a class="reference" href="#kw">keyword</a> is the same as <tt class="docutils literal"><span class="pre">w</span></tt>'s, |
---|
237 | returns <em>b</em>'s <em>value</em> (by |
---|
238 | reference). Otherwise, invokes <tt class="docutils literal"><span class="pre">w</span></tt>'s <em>value</em> and returns the result.</td> |
---|
239 | </tr> |
---|
240 | <tr><td><tt class="docutils literal"><span class="pre">x,</span> <span class="pre">z</span></tt></td> |
---|
241 | <td>Model of <span class="concept">ArgumentPack</span></td> |
---|
242 | <td><em>none</em></td> |
---|
243 | <td>Returns an <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing |
---|
244 | all the elements of both <tt class="docutils literal"><span class="pre">x</span></tt> and |
---|
245 | <tt class="docutils literal"><span class="pre">z</span></tt>.</td> |
---|
246 | </tr> |
---|
247 | </tbody> |
---|
248 | </table> |
---|
249 | </div> |
---|
250 | </div> |
---|
251 | <div class="section"> |
---|
252 | <h2><a class="toc-backref" href="#id38" id="id5" name="id5"><span id="parameterspec"></span>3.2 <span class="concept">ParameterSpec</span></a></h2> |
---|
253 | <p>A <span class="concept">ParameterSpec</span> describes the type requirements for arguments |
---|
254 | corresponding to a given <a class="reference" href="#kw">keyword</a> and indicates whether the argument |
---|
255 | is optional or required. The table below details the allowed forms |
---|
256 | and describes their condition for satisfaction by an actual |
---|
257 | argument type. In each row,</p> |
---|
258 | <ul class="simple" id="conditions"> |
---|
259 | <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> |
---|
260 | <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> |
---|
261 | <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> |
---|
262 | </ul> |
---|
263 | <table border="1" class="docutils"> |
---|
264 | <caption><span class="concept">ParameterSpec</span> allowed forms and conditions of satisfaction</caption> |
---|
265 | <colgroup> |
---|
266 | <col width="32%" /> |
---|
267 | <col width="21%" /> |
---|
268 | <col width="47%" /> |
---|
269 | </colgroup> |
---|
270 | <thead valign="bottom"> |
---|
271 | <tr><th class="head">Type</th> |
---|
272 | <th class="head"><tt class="docutils literal"><span class="pre">A</span></tt> required</th> |
---|
273 | <th class="head">Condition <tt class="docutils literal"><span class="pre">A</span></tt> must satisfy</th> |
---|
274 | </tr> |
---|
275 | </thead> |
---|
276 | <tbody valign="top"> |
---|
277 | <tr><td><tt class="docutils literal"><span class="pre">K</span></tt></td> |
---|
278 | <td>no</td> |
---|
279 | <td><em>n/a</em></td> |
---|
280 | </tr> |
---|
281 | <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> |
---|
282 | <td>no</td> |
---|
283 | <td><tt class="docutils literal"><span class="pre">mpl::apply<F,A>::type::value</span></tt> |
---|
284 | is <tt class="docutils literal"><span class="pre">true</span></tt>.</td> |
---|
285 | </tr> |
---|
286 | <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> |
---|
287 | <td>yes</td> |
---|
288 | <td><tt class="docutils literal"><span class="pre">mpl::apply<F,A>::type::value</span></tt> |
---|
289 | is <tt class="docutils literal"><span class="pre">true</span></tt>.</td> |
---|
290 | </tr> |
---|
291 | </tbody> |
---|
292 | </table> |
---|
293 | <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 |
---|
294 | arguments that will be matched by <a class="reference" href="index.html#forwarding-functions">forwarding functions</a>.</p> |
---|
295 | </div> |
---|
296 | </div> |
---|
297 | <hr class="docutils" /> |
---|
298 | <div class="section"> |
---|
299 | <h1><a class="toc-backref" href="#id39" id="class-templates" name="class-templates">4 Class Templates</a></h1> |
---|
300 | <div class="section"> |
---|
301 | <h2><a class="toc-backref" href="#id40" id="id7" name="id7"><span id="keyword"></span>4.1 <tt class="docutils literal"><span class="pre">keyword</span></tt></a></h2> |
---|
302 | <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> |
---|
303 | <table class="docutils field-list" frame="void" rules="none"> |
---|
304 | <col class="field-name" /> |
---|
305 | <col class="field-body" /> |
---|
306 | <tbody valign="top"> |
---|
307 | <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> |
---|
308 | </tr> |
---|
309 | </tbody> |
---|
310 | </table> |
---|
311 | <pre class="literal-block"> |
---|
312 | template <class Tag> |
---|
313 | struct keyword |
---|
314 | { |
---|
315 | template <class T> <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#operator">operator=</a>(T& value) const; |
---|
316 | 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; |
---|
317 | |
---|
318 | template <class T> <em>tagged default</em> <a class="reference" href="#id9">operator|</a>(T& x) const; |
---|
319 | template <class T> <em>tagged default</em> <a class="reference" href="#id9">operator|</a>(T const& x) const; |
---|
320 | |
---|
321 | template <class F> <em>tagged lazy default</em> <a class="reference" href="#id10">operator||</a>(F const&) const; |
---|
322 | |
---|
323 | static keyword<Tag>& <a class="reference" href="#get">get</a>(); |
---|
324 | }; |
---|
325 | </pre> |
---|
326 | <dl class="docutils" id="operator"> |
---|
327 | <dt><tt class="docutils literal"><span class="pre">operator=</span></tt></dt> |
---|
328 | <dd><pre class="first literal-block"> |
---|
329 | template <class T> <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T& value) const; |
---|
330 | template <class T> <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T const& value) const; |
---|
331 | </pre> |
---|
332 | <table class="last docutils field-list" frame="void" rules="none"> |
---|
333 | <col class="field-name" /> |
---|
334 | <col class="field-body" /> |
---|
335 | <tbody valign="top"> |
---|
336 | <tr class="field"><th class="field-name">Requires:</th><td class="field-body">nothing</td> |
---|
337 | </tr> |
---|
338 | <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 |
---|
339 | <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> |
---|
340 | </tr> |
---|
341 | </tbody> |
---|
342 | </table> |
---|
343 | </dd> |
---|
344 | </dl> |
---|
345 | <dl class="docutils" id="id9"> |
---|
346 | <dt><tt class="docutils literal"><span class="pre">operator|</span></tt></dt> |
---|
347 | <dd><pre class="first literal-block"> |
---|
348 | template <class T> <em>tagged default</em> operator|(T& x) const; |
---|
349 | template <class T> <em>tagged default</em> operator|(T const& x) const; |
---|
350 | </pre> |
---|
351 | <table class="last docutils field-list" frame="void" rules="none"> |
---|
352 | <col class="field-name" /> |
---|
353 | <col class="field-body" /> |
---|
354 | <tbody valign="top"> |
---|
355 | <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> |
---|
356 | </tr> |
---|
357 | </tbody> |
---|
358 | </table> |
---|
359 | </dd> |
---|
360 | </dl> |
---|
361 | <dl class="docutils" id="id10"> |
---|
362 | <dt><tt class="docutils literal"><span class="pre">operator||</span></tt></dt> |
---|
363 | <dd><pre class="first literal-block"> |
---|
364 | template <class F> <em>tagged lazy default</em> operator||(F const& g) const; |
---|
365 | </pre> |
---|
366 | <table class="last docutils field-list" frame="void" rules="none"> |
---|
367 | <col class="field-name" /> |
---|
368 | <col class="field-body" /> |
---|
369 | <tbody valign="top"> |
---|
370 | <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="id11" name="id11"><sup>2</sup></a></td> |
---|
371 | </tr> |
---|
372 | <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> |
---|
373 | </tr> |
---|
374 | </tbody> |
---|
375 | </table> |
---|
376 | </dd> |
---|
377 | </dl> |
---|
378 | <dl class="docutils" id="get"> |
---|
379 | <dt><tt class="docutils literal"><span class="pre">get</span></tt></dt> |
---|
380 | <dd><pre class="first literal-block"> |
---|
381 | static keyword<Tag>& get(); |
---|
382 | </pre> |
---|
383 | <table class="last docutils field-list" frame="void" rules="none"> |
---|
384 | <col class="field-name" /> |
---|
385 | <col class="field-body" /> |
---|
386 | <tbody valign="top"> |
---|
387 | <tr class="field"><th class="field-name">Returns:</th><td class="field-body">a “singleton instance”: the same object will be |
---|
388 | returned on each invocation of <tt class="docutils literal"><span class="pre">get()</span></tt>.</td> |
---|
389 | </tr> |
---|
390 | <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 |
---|
391 | simultaneously.</td> |
---|
392 | </tr> |
---|
393 | </tbody> |
---|
394 | </table> |
---|
395 | </dd> |
---|
396 | </dl> |
---|
397 | </div> |
---|
398 | <div class="section"> |
---|
399 | <h2><a class="toc-backref" href="#id41" id="parameters" name="parameters">4.2 <tt class="docutils literal"><span class="pre">parameters</span></tt></a></h2> |
---|
400 | <p>Provides an interface for assembling the actual arguments to a |
---|
401 | <cite>forwarding function</cite> into an <span class="concept">ArgumentPack</span>, in which any |
---|
402 | <a class="reference" href="#positional">positional</a> arguments will be tagged according to the |
---|
403 | corresponding template argument to <tt class="docutils literal"><span class="pre">parameters</span></tt>.</p> |
---|
404 | <table class="docutils field-list" frame="void" rules="none"> |
---|
405 | <col class="field-name" /> |
---|
406 | <col class="field-body" /> |
---|
407 | <tbody valign="top"> |
---|
408 | <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> |
---|
409 | </tr> |
---|
410 | </tbody> |
---|
411 | </table> |
---|
412 | <pre class="literal-block"> |
---|
413 | template <class P0 = <em>unspecified</em>, class P1 = <em>unspecified</em>, …class Pβ = <em>unspecified</em>> |
---|
414 | struct parameters |
---|
415 | { |
---|
416 | template <class A0, class A1 = <em>unspecified</em>, …class Aβ = <em>unspecified</em>> |
---|
417 | struct <a class="reference" href="#match">match</a> |
---|
418 | { |
---|
419 | typedef … type; |
---|
420 | }; |
---|
421 | |
---|
422 | template <class A0> |
---|
423 | <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id13">operator()</a>(A0& a0) const; |
---|
424 | |
---|
425 | template <class A0, class A1> |
---|
426 | <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id13">operator()</a>(A0& a0, A1& a1) const; |
---|
427 | |
---|
428 | <span class="vellipsis">⋮</span> |
---|
429 | |
---|
430 | template <class A0, class A1, …class Aβ> |
---|
431 | <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id13">operator()</a>(A0& a0, A1& a1, …Aβ& aβ) const; |
---|
432 | }; |
---|
433 | </pre> |
---|
434 | <table class="docutils field-list" frame="void" rules="none"> |
---|
435 | <col class="field-name" /> |
---|
436 | <col class="field-body" /> |
---|
437 | <tbody valign="top"> |
---|
438 | <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> |
---|
439 | </tr> |
---|
440 | </tbody> |
---|
441 | </table> |
---|
442 | <div class="note"> |
---|
443 | <p class="first admonition-title">Note</p> |
---|
444 | <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 |
---|
445 | follows, for any argument type <tt class="docutils literal"><span class="pre">A</span></tt><em>i</em>:</p> |
---|
446 | <blockquote class="last"> |
---|
447 | <div class="line-block"> |
---|
448 | <div class="line">let <tt class="docutils literal"><span class="pre">D0</span></tt> the set [d0, …, d<em>j</em>] of all <strong>deduced</strong> <em>parameter specs</em> in [<tt class="docutils literal"><span class="pre">P0</span></tt>, …, <tt class="docutils literal"><span class="pre">P</span></tt>β]</div> |
---|
449 | <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> |
---|
450 | <div class="line"><br /></div> |
---|
451 | <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> |
---|
452 | <div class="line">then</div> |
---|
453 | <div class="line-block"> |
---|
454 | <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> |
---|
455 | </div> |
---|
456 | <div class="line">else</div> |
---|
457 | <div class="line-block"> |
---|
458 | <div class="line">if some <tt class="docutils literal"><span class="pre">A</span></tt><em>j</em> where <em>j</em>≤<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> |
---|
459 | <div class="line"><em>or</em> some <tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> in <em>j</em>≤<em>i</em> is <strong>deduced</strong></div> |
---|
460 | <div class="line">then</div> |
---|
461 | <div class="line-block"> |
---|
462 | <div class="line">if some <em>parameter spec</em> <tt class="docutils literal"><span class="pre">d</span></tt><em>j</em> in <tt class="docutils literal"><span class="pre">D</span></tt><em>i</em> matches <tt class="docutils literal"><span class="pre">A</span></tt><em>i</em></div> |
---|
463 | <div class="line">then</div> |
---|
464 | <div class="line-block"> |
---|
465 | <div class="line"><tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> is <tt class="docutils literal"><span class="pre">d</span></tt><em>j</em>'s <a class="reference" href="#keyword-tag-type">keyword tag type</a>.</div> |
---|
466 | <div class="line"><tt class="docutils literal"><span class="pre">D</span></tt><sub>i+1</sub> is <tt class="docutils literal"><span class="pre">D</span></tt><em>i</em> - [<tt class="docutils literal"><span class="pre">d</span></tt><em>j</em>]</div> |
---|
467 | </div> |
---|
468 | </div> |
---|
469 | <div class="line">else</div> |
---|
470 | <div class="line-block"> |
---|
471 | <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> |
---|
472 | </div> |
---|
473 | </div> |
---|
474 | </div> |
---|
475 | </blockquote> |
---|
476 | </div> |
---|
477 | <dl class="docutils" id="match"> |
---|
478 | <dt><tt class="docutils literal"><span class="pre">match</span></tt></dt> |
---|
479 | <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> |
---|
480 | <table class="docutils field-list" frame="void" rules="none"> |
---|
481 | <col class="field-name" /> |
---|
482 | <col class="field-body" /> |
---|
483 | <tbody valign="top"> |
---|
484 | <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 |
---|
485 | below), then <tt class="docutils literal"><span class="pre">parameters<P0,P1,…Pβ></span></tt>. Otherwise, |
---|
486 | <tt class="docutils literal"><span class="pre">match<A0,A1,…Aβ>::type</span></tt> is not defined.</td> |
---|
487 | </tr> |
---|
488 | </tbody> |
---|
489 | </table> |
---|
490 | <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 |
---|
491 | every <em>j</em> in 0…β, either:</p> |
---|
492 | <ul class="last simple"> |
---|
493 | <li><tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is the <em>unspecified</em> default</li> |
---|
494 | <li><strong>or</strong>, <tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is a <em>keyword tag type</em></li> |
---|
495 | <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> |
---|
496 | <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> |
---|
497 | <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> |
---|
498 | </ul> |
---|
499 | </li> |
---|
500 | <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> |
---|
501 | <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> |
---|
502 | <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> |
---|
503 | </ul> |
---|
504 | </li> |
---|
505 | </ul> |
---|
506 | </dd> |
---|
507 | </dl> |
---|
508 | <dl class="docutils" id="id13"> |
---|
509 | <dt><tt class="docutils literal"><span class="pre">operator()</span></tt></dt> |
---|
510 | <dd><pre class="first literal-block"> |
---|
511 | template <class A0> <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator()(A0 const& a0) const; |
---|
512 | |
---|
513 | <span class="vellipsis">⋮</span> |
---|
514 | |
---|
515 | template <class A0, …class Aβ> <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id13">operator()</a>(A0 const& a0, …Aβ const& aβ) const; |
---|
516 | </pre> |
---|
517 | <table class="last docutils field-list" frame="void" rules="none"> |
---|
518 | <col class="field-name" /> |
---|
519 | <col class="field-body" /> |
---|
520 | <tbody valign="top"> |
---|
521 | <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> |
---|
522 | <ul class="last simple"> |
---|
523 | <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> |
---|
524 | <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> |
---|
525 | </ul> |
---|
526 | </td> |
---|
527 | </tr> |
---|
528 | </tbody> |
---|
529 | </table> |
---|
530 | </dd> |
---|
531 | </dl> |
---|
532 | </div> |
---|
533 | <div class="section"> |
---|
534 | <h2><a class="toc-backref" href="#id42" id="optional-required" name="optional-required"><span id="required"></span><span id="optional"></span>4.3 <tt class="docutils literal"><span class="pre">optional</span></tt>, <tt class="docutils literal"><span class="pre">required</span></tt></a></h2> |
---|
535 | <p>These templates describe the requirements on a function parameter.</p> |
---|
536 | <table class="docutils field-list" frame="void" rules="none"> |
---|
537 | <col class="field-name" /> |
---|
538 | <col class="field-body" /> |
---|
539 | <tbody valign="top"> |
---|
540 | <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> |
---|
541 | </tr> |
---|
542 | </tbody> |
---|
543 | </table> |
---|
544 | <table class="docutils field-list" frame="void" rules="none"> |
---|
545 | <col class="field-name" /> |
---|
546 | <col class="field-body" /> |
---|
547 | <tbody valign="top"> |
---|
548 | <tr class="field"><th class="field-name" colspan="2">Specializations model:</th></tr> |
---|
549 | <tr><td> </td><td class="field-body"><a class="reference" href="#parameterspec"><span class="concept">ParameterSpec</span></a></td> |
---|
550 | </tr> |
---|
551 | </tbody> |
---|
552 | </table> |
---|
553 | <pre class="literal-block"> |
---|
554 | template <class Tag, class Predicate = <em>unspecified</em>> |
---|
555 | struct optional; |
---|
556 | |
---|
557 | template <class Tag, class Predicate = <em>unspecified</em>> |
---|
558 | struct required; |
---|
559 | </pre> |
---|
560 | <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 |
---|
561 | <tt class="docutils literal"><span class="pre">mpl::true_</span></tt> for any argument.</p> |
---|
562 | </div> |
---|
563 | <div class="section"> |
---|
564 | <h2><a class="toc-backref" href="#id43" id="deduced" name="deduced">4.4 <tt class="docutils literal"><span class="pre">deduced</span></tt></a></h2> |
---|
565 | <p>This template is used to wrap the <em>keyword tag</em> argument to |
---|
566 | <tt class="docutils literal"><span class="pre">optional</span></tt> or <tt class="docutils literal"><span class="pre">required</span></tt>.</p> |
---|
567 | <table class="docutils field-list" frame="void" rules="none"> |
---|
568 | <col class="field-name" /> |
---|
569 | <col class="field-body" /> |
---|
570 | <tbody valign="top"> |
---|
571 | <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> |
---|
572 | </tr> |
---|
573 | </tbody> |
---|
574 | </table> |
---|
575 | <pre class="literal-block"> |
---|
576 | template <class Tag> |
---|
577 | struct deduced; |
---|
578 | </pre> |
---|
579 | </div> |
---|
580 | </div> |
---|
581 | <hr class="docutils" /> |
---|
582 | <div class="section"> |
---|
583 | <h1><a class="toc-backref" href="#id44" id="metafunctions" name="metafunctions">5 Metafunctions</a></h1> |
---|
584 | <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 |
---|
585 | returns, C++ types.</p> |
---|
586 | <div class="section"> |
---|
587 | <h2><a class="toc-backref" href="#id45" id="binding" name="binding">5.1 <tt class="docutils literal"><span class="pre">binding</span></tt></a></h2> |
---|
588 | <p>Returns the result type of indexing an argument pack with a |
---|
589 | <a class="reference" href="#keyword-tag-type">keyword tag type</a> or with a <a class="reference" href="#tagged-default">tagged default</a>.</p> |
---|
590 | <table class="docutils field-list" frame="void" rules="none"> |
---|
591 | <col class="field-name" /> |
---|
592 | <col class="field-body" /> |
---|
593 | <tbody valign="top"> |
---|
594 | <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> |
---|
595 | </tr> |
---|
596 | </tbody> |
---|
597 | </table> |
---|
598 | <pre class="literal-block"> |
---|
599 | template <class A, class K, class D = void> |
---|
600 | struct binding |
---|
601 | { |
---|
602 | typedef … type; |
---|
603 | }; |
---|
604 | </pre> |
---|
605 | <table class="docutils field-list" frame="void" rules="none"> |
---|
606 | <col class="field-name" /> |
---|
607 | <col class="field-body" /> |
---|
608 | <tbody valign="top"> |
---|
609 | <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> |
---|
610 | </tr> |
---|
611 | <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> |
---|
612 | 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> |
---|
613 | </tr> |
---|
614 | </tbody> |
---|
615 | </table> |
---|
616 | </div> |
---|
617 | <div class="section"> |
---|
618 | <h2><a class="toc-backref" href="#id46" id="lazy-binding" name="lazy-binding">5.2 <tt class="docutils literal"><span class="pre">lazy_binding</span></tt></a></h2> |
---|
619 | <p>Returns the result type of indexing an argument pack with a <a class="reference" href="#tagged-lazy-default">tagged lazy default</a>.</p> |
---|
620 | <table class="docutils field-list" frame="void" rules="none"> |
---|
621 | <col class="field-name" /> |
---|
622 | <col class="field-body" /> |
---|
623 | <tbody valign="top"> |
---|
624 | <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> |
---|
625 | </tr> |
---|
626 | </tbody> |
---|
627 | </table> |
---|
628 | <pre class="literal-block"> |
---|
629 | template <class A, class K, class F> |
---|
630 | struct lazy_binding |
---|
631 | { |
---|
632 | typedef … type; |
---|
633 | }; |
---|
634 | </pre> |
---|
635 | <table class="docutils field-list" frame="void" rules="none"> |
---|
636 | <col class="field-name" /> |
---|
637 | <col class="field-body" /> |
---|
638 | <tbody valign="top"> |
---|
639 | <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> |
---|
640 | </tr> |
---|
641 | <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> |
---|
642 | 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="id18" name="id18"><sup>2</sup></a></td> |
---|
643 | </tr> |
---|
644 | </tbody> |
---|
645 | </table> |
---|
646 | </div> |
---|
647 | <div class="section"> |
---|
648 | <h2><a class="toc-backref" href="#id47" id="value-type" name="value-type">5.3 <tt class="docutils literal"><span class="pre">value_type</span></tt></a></h2> |
---|
649 | <p>Returns the result type of indexing an argument pack with a |
---|
650 | <a class="reference" href="#keyword-tag-type">keyword tag type</a> or with a <a class="reference" href="#tagged-default">tagged default</a>.</p> |
---|
651 | <table class="docutils field-list" frame="void" rules="none"> |
---|
652 | <col class="field-name" /> |
---|
653 | <col class="field-body" /> |
---|
654 | <tbody valign="top"> |
---|
655 | <tr class="field"><th class="field-name">Defined n:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/value_type.hpp">boost/parameter/value_type.hpp</a></td> |
---|
656 | </tr> |
---|
657 | </tbody> |
---|
658 | </table> |
---|
659 | <pre class="literal-block"> |
---|
660 | template <class A, class K, class D = void> |
---|
661 | struct value_type |
---|
662 | { |
---|
663 | typedef … type; |
---|
664 | }; |
---|
665 | </pre> |
---|
666 | <table class="docutils field-list" frame="void" rules="none"> |
---|
667 | <col class="field-name" /> |
---|
668 | <col class="field-body" /> |
---|
669 | <tbody valign="top"> |
---|
670 | <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 model of <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</p> |
---|
671 | </td> |
---|
672 | </tr> |
---|
673 | <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the type of the <a class="reference" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal"><span class="pre">A</span></tt> |
---|
674 | 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>. Equivalent to:</p> |
---|
675 | <pre class="literal-block"> |
---|
676 | typename remove_reference< |
---|
677 | typename binding<A, K, D>::type |
---|
678 | >::type |
---|
679 | </pre> |
---|
680 | <p class="last">… when <tt class="docutils literal"><span class="pre">D</span></tt> is not a reference type.</p> |
---|
681 | </td> |
---|
682 | </tr> |
---|
683 | </tbody> |
---|
684 | </table> |
---|
685 | </div> |
---|
686 | </div> |
---|
687 | <hr class="docutils" /> |
---|
688 | <div class="section"> |
---|
689 | <h1><a class="toc-backref" href="#id48" id="code-generation-macros" name="code-generation-macros">6 Code Generation Macros</a></h1> |
---|
690 | <p>Macros in this section can be used to ease the writing of code |
---|
691 | using the Parameter libray by eliminating repetitive boilerplate.</p> |
---|
692 | <div class="section"> |
---|
693 | <h2><a class="toc-backref" href="#id49" id="boost-parameter-function-result-name-tag-namespace-arguments" name="boost-parameter-function-result-name-tag-namespace-arguments">6.1 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></a></h2> |
---|
694 | <table class="docutils field-list" frame="void" rules="none"> |
---|
695 | <col class="field-name" /> |
---|
696 | <col class="field-body" /> |
---|
697 | <tbody valign="top"> |
---|
698 | <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td> |
---|
699 | </tr> |
---|
700 | </tbody> |
---|
701 | </table> |
---|
702 | <table class="docutils field-list" frame="void" rules="none"> |
---|
703 | <col class="field-name" /> |
---|
704 | <col class="field-body" /> |
---|
705 | <tbody valign="top"> |
---|
706 | <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal"><span class="pre">result</span></tt> is the parenthesized return type of the function. |
---|
707 | <tt class="docutils literal"><span class="pre">name</span></tt> is the base name of the function, this is the name of the |
---|
708 | generated forwarding functions. <tt class="docutils literal"><span class="pre">tag_namespace</span></tt> is the namespace in |
---|
709 | which the keywords used by the function resides. <tt class="docutils literal"><span class="pre">arguments</span></tt> is |
---|
710 | a list of <em>argument specifiers</em>, as defined below.</p> |
---|
711 | </td> |
---|
712 | </tr> |
---|
713 | <tr class="field"><th class="field-name" colspan="2">Argument specifiers syntax:</th></tr> |
---|
714 | <tr><td> </td><td class="field-body"><pre class="first literal-block"> |
---|
715 | argument-specifiers ::= <em>specifier-group</em> {<em>specifier-group</em>} |
---|
716 | |
---|
717 | specifier-group0 ::= <em>specifier-group1</em> | |
---|
718 | ( '<strong>(</strong>' '<strong>deduced</strong>' <em>specifier-group1</em> {<em>specifier-group1</em>} '<strong>)</strong>' ) |
---|
719 | |
---|
720 | specifier-group1 ::= ( '<strong>(</strong>' '<strong>optional</strong>' <em>optional-specifier</em> {<em>optional-specifier</em>} '<strong>)</strong>' ) | |
---|
721 | ( '<strong>(</strong>' '<strong>required</strong>' <em>required-specifier</em> {<em>required-specifier</em>} '<strong>)</strong>' ) |
---|
722 | |
---|
723 | optional-specifier ::= '<strong>(</strong>' <em>name</em> '<strong>,</strong>' <em>restriction</em> '<strong>,</strong>' <em>default-value</em> ')' |
---|
724 | required-specifier ::= '<strong>(</strong>' <em>name</em> '<strong>,</strong>' <em>restriction</em> ')' |
---|
725 | |
---|
726 | restriction ::= ('<strong>*</strong>' '<strong>(</strong>' <em>lambda-expression</em> '<strong>)</strong>' ) | |
---|
727 | ( '<strong>(</strong>' <em>typename</em> '<strong>)</strong>' ) | |
---|
728 | '<strong>*</strong>' |
---|
729 | </pre> |
---|
730 | <p class="last"><tt class="docutils literal"><span class="pre">name</span></tt> is any valid C++ identifier. <tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid |
---|
731 | C++ expression. <tt class="docutils literal"><span class="pre">typename</span></tt> is the name of a type. |
---|
732 | <tt class="docutils literal"><span class="pre">lambda-expression</span></tt> is an <a class="reference" href="../../../mpl/doc/refmanual/lambda-expression.html">MPL lambda expression</a>.</p> |
---|
733 | </td> |
---|
734 | </tr> |
---|
735 | </tbody> |
---|
736 | </table> |
---|
737 | <table class="docutils field-list" frame="void" rules="none"> |
---|
738 | <col class="field-name" /> |
---|
739 | <col class="field-body" /> |
---|
740 | <tbody valign="top"> |
---|
741 | <tr class="field"><th class="field-name" colspan="2">Generated names in enclosing scope:</th></tr> |
---|
742 | <tr><td> </td><td class="field-body"><ul class="first last simple"> |
---|
743 | <li><tt class="docutils literal"><span class="pre">boost_param_result_</span> <span class="pre">##</span> <span class="pre">__LINE__</span> <span class="pre">##</span> <span class="pre">name</span></tt></li> |
---|
744 | <li><tt class="docutils literal"><span class="pre">boost_param_params_</span> <span class="pre">##</span> <span class="pre">__LINE__</span> <span class="pre">##</span> <span class="pre">name</span></tt></li> |
---|
745 | <li><tt class="docutils literal"><span class="pre">boost_param_parameters_</span> <span class="pre">##</span> <span class="pre">__LINE__</span> <span class="pre">##</span> <span class="pre">name</span></tt></li> |
---|
746 | <li><tt class="docutils literal"><span class="pre">boost_param_impl</span> <span class="pre">##</span> <span class="pre">name</span></tt></li> |
---|
747 | <li><tt class="docutils literal"><span class="pre">boost_param_default_</span> <span class="pre">##</span> <span class="pre">__LINE__</span> <span class="pre">##</span> <span class="pre">name</span></tt></li> |
---|
748 | </ul> |
---|
749 | </td> |
---|
750 | </tr> |
---|
751 | </tbody> |
---|
752 | </table> |
---|
753 | <dl class="docutils"> |
---|
754 | <dt>Approximate expansion:</dt> |
---|
755 | <dd><p class="first"><strong>Where</strong>:</p> |
---|
756 | <ul class="simple"> |
---|
757 | <li><tt class="docutils literal"><span class="pre">n</span></tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal"><span class="pre">arguments</span></tt>.</li> |
---|
758 | <li><tt class="docutils literal"><span class="pre">m</span></tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal"><span class="pre">arguments</span></tt>.</li> |
---|
759 | </ul> |
---|
760 | <pre class="last literal-block"> |
---|
761 | template <class T> |
---|
762 | struct boost_param_result_ ## __LINE__ ## <strong>name</strong> |
---|
763 | { |
---|
764 | typedef <strong>result</strong> type; |
---|
765 | }; |
---|
766 | |
---|
767 | struct boost_param_params_ ## __LINE__ ## <strong>name</strong> |
---|
768 | : boost::parameter::parameters< |
---|
769 | <em>list of parameter specifications, based on arguments</em> |
---|
770 | > |
---|
771 | {}; |
---|
772 | |
---|
773 | typedef boost_param_params_ ## __LINE__ ## <strong>name</strong> |
---|
774 | boost_param_parameters_ ## __LINE__ ## <strong>name</strong>; |
---|
775 | |
---|
776 | template <class A0, …, class A<strong>n</strong>> |
---|
777 | <em>result type</em> <strong>name</strong>( |
---|
778 | A0 <em>cv</em>& a0, …, A<strong>n</strong> <em>cv</em>& a<strong>n</strong> |
---|
779 | , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>::match< |
---|
780 | A0 <em>cv</em>, …, A<strong>n</strong> <em>cv</em> |
---|
781 | >::type = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>() |
---|
782 | ) |
---|
783 | { |
---|
784 | <em>… forward to implementation …</em> |
---|
785 | } |
---|
786 | |
---|
787 | <span class="vellipsis">⋮</span> |
---|
788 | |
---|
789 | template <class A0, …, class A<strong>m</strong>> |
---|
790 | <em>result type</em> <strong>name</strong>( |
---|
791 | A0 <em>cv</em>& a0, …, A<strong>m</strong> <em>cv</em>& a<strong>m</strong> |
---|
792 | , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>::match< |
---|
793 | A0 <em>cv</em>, …, A<strong>m</strong> <em>cv</em> |
---|
794 | >::type = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>() |
---|
795 | ) |
---|
796 | { |
---|
797 | <em>… forward to implementation …</em> |
---|
798 | } |
---|
799 | |
---|
800 | template < |
---|
801 | class ResultType |
---|
802 | , class <em>argument name</em><strong>0</strong> ## _type |
---|
803 | … |
---|
804 | , class <em>argument name</em><strong>m</strong> ## _type |
---|
805 | > |
---|
806 | ResultType boost_param_default_ ## __LINE__ ## <strong>name</strong>( |
---|
807 | (ResultType(*)()) |
---|
808 | , <em>argument name</em><strong>0</strong> ## _type& <em>argument name</em><strong>0</strong> |
---|
809 | … |
---|
810 | , <em>argument name</em><strong>m</strong> ## _type& <em>argument name</em><strong>m</strong> |
---|
811 | ) |
---|
812 | </pre> |
---|
813 | </dd> |
---|
814 | </dl> |
---|
815 | </div> |
---|
816 | <div class="section"> |
---|
817 | <h2><a class="toc-backref" href="#id50" id="boost-parameter-member-function-result-name-tag-namespace-arguments" name="boost-parameter-member-function-result-name-tag-namespace-arguments">6.2 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MEMBER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></a></h2> |
---|
818 | <table class="docutils field-list" frame="void" rules="none"> |
---|
819 | <col class="field-name" /> |
---|
820 | <col class="field-body" /> |
---|
821 | <tbody valign="top"> |
---|
822 | <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td> |
---|
823 | </tr> |
---|
824 | </tbody> |
---|
825 | </table> |
---|
826 | <p>See <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></p> |
---|
827 | </div> |
---|
828 | <div class="section"> |
---|
829 | <h2><a class="toc-backref" href="#id51" id="boost-parameter-constructor-cls-impl-tag-namespace-arguments" name="boost-parameter-constructor-cls-impl-tag-namespace-arguments">6.3 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_CONSTRUCTOR(cls,</span> <span class="pre">impl,</span> <span class="pre">tag_namespace,</span> <span class="pre">arguments)</span></tt></a></h2> |
---|
830 | <table class="docutils field-list" frame="void" rules="none"> |
---|
831 | <col class="field-name" /> |
---|
832 | <col class="field-body" /> |
---|
833 | <tbody valign="top"> |
---|
834 | <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td> |
---|
835 | </tr> |
---|
836 | </tbody> |
---|
837 | </table> |
---|
838 | <table class="docutils field-list" frame="void" rules="none"> |
---|
839 | <col class="field-name" /> |
---|
840 | <col class="field-body" /> |
---|
841 | <tbody valign="top"> |
---|
842 | <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal"><span class="pre">cls</span></tt> is the name of this class. <tt class="docutils literal"><span class="pre">impl</span></tt> is the |
---|
843 | parenthesized implementation base class for <tt class="docutils literal"><span class="pre">cls</span></tt>. |
---|
844 | <tt class="docutils literal"><span class="pre">tag_namespace</span></tt> is the namespace in which the keywords |
---|
845 | used by the function resides. <tt class="docutils literal"><span class="pre">arguments</span></tt> is |
---|
846 | a list of <em>argument specifiers</em>, as defined in |
---|
847 | <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</span></tt>.</p> |
---|
848 | </td> |
---|
849 | </tr> |
---|
850 | <tr class="field"><th class="field-name" colspan="2">Generated names in enclosing scope:</th></tr> |
---|
851 | <tr><td> </td><td class="field-body"><ul class="first last simple"> |
---|
852 | <li><tt class="docutils literal"><span class="pre">boost_param_params_</span> <span class="pre">##</span> <span class="pre">__LINE__</span> <span class="pre">##</span> <span class="pre">ctor</span></tt></li> |
---|
853 | <li><tt class="docutils literal"><span class="pre">constructor_parameters</span> <span class="pre">##</span> <span class="pre">__LINE__</span></tt></li> |
---|
854 | </ul> |
---|
855 | </td> |
---|
856 | </tr> |
---|
857 | </tbody> |
---|
858 | </table> |
---|
859 | <dl class="docutils"> |
---|
860 | <dt>Approximate expansion:</dt> |
---|
861 | <dd><p class="first"><strong>Where</strong>:</p> |
---|
862 | <ul class="simple"> |
---|
863 | <li><tt class="docutils literal"><span class="pre">n</span></tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal"><span class="pre">arguments</span></tt>.</li> |
---|
864 | <li><tt class="docutils literal"><span class="pre">m</span></tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal"><span class="pre">arguments</span></tt>.</li> |
---|
865 | </ul> |
---|
866 | <pre class="last literal-block"> |
---|
867 | struct boost_param_params_ ## __LINE__ ## ctor |
---|
868 | : boost::parameter::parameters< |
---|
869 | <em>list of parameter specifications, based on arguments</em> |
---|
870 | > |
---|
871 | {}; |
---|
872 | |
---|
873 | typedef boost_param_params_ ## __LINE__ ## <strong>name</strong> |
---|
874 | constructor_parameters ## __LINE__; |
---|
875 | |
---|
876 | template <class A0, …, class A<strong>n</strong>> |
---|
877 | <em>cls</em>(A0 const& a0, …, A<strong>n</strong> const& a<strong>n</strong>) |
---|
878 | : <em>impl</em>(constructor_parameters ## __LINE__(a0, …, a<strong>n</strong>)) |
---|
879 | {} |
---|
880 | |
---|
881 | <span class="vellipsis">⋮</span> |
---|
882 | |
---|
883 | template <class A0, …, class A<strong>m</strong>> |
---|
884 | <em>cls</em>(A0 const& a0, …, A<strong>n</strong> const& a<strong>m</strong>) |
---|
885 | : <em>impl</em>(constructor_parameters ## __LINE__(a0, …, a<strong>m</strong>)) |
---|
886 | {} |
---|
887 | </pre> |
---|
888 | </dd> |
---|
889 | </dl> |
---|
890 | </div> |
---|
891 | <div class="section"> |
---|
892 | <h2><a class="toc-backref" href="#id52" id="boost-parameter-name-name" name="boost-parameter-name-name">6.4 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_NAME(name)</span></tt></a></h2> |
---|
893 | <p>Declares a tag-type and keyword object.</p> |
---|
894 | <p>Expands to:</p> |
---|
895 | <p><strong>If</strong> <em>name</em> is of the form:</p> |
---|
896 | <pre class="literal-block"> |
---|
897 | (<em>tag-name</em>, <em>namespace-name</em>) <em>object-name</em> |
---|
898 | </pre> |
---|
899 | <p><strong>then</strong></p> |
---|
900 | <pre class="literal-block"> |
---|
901 | namespace <em>namespace-name</em> |
---|
902 | { |
---|
903 | struct <em>tag-name</em> |
---|
904 | { |
---|
905 | static char const* keyword_name() |
---|
906 | { |
---|
907 | return ##<em>tag-name</em>; |
---|
908 | } |
---|
909 | |
---|
910 | typedef <em>implementation defined</em> _; |
---|
911 | typedef <em>implementation defined</em> _1; |
---|
912 | }; |
---|
913 | } |
---|
914 | |
---|
915 | ::boost::parameter::keyword<<em>tag-namespace</em>::<em>tag-name</em>> const& <em>object-name</em> |
---|
916 | = ::boost::parameter::keyword<<em>tag-namespace</em>::<em>tag-name</em>>::instance; |
---|
917 | </pre> |
---|
918 | <p><strong>Else</strong></p> |
---|
919 | <pre class="literal-block"> |
---|
920 | namespace tag |
---|
921 | { |
---|
922 | struct <em>name</em> |
---|
923 | { |
---|
924 | static char const* keyword_name() |
---|
925 | { |
---|
926 | return ##<em>name</em>; |
---|
927 | } |
---|
928 | |
---|
929 | typedef <em>implementation defined</em> _; |
---|
930 | typedef <em>implementation defined</em> _1; |
---|
931 | }; |
---|
932 | } |
---|
933 | |
---|
934 | ::boost::parameter::keyword<tag::<em>name</em>> const& _<em>name</em> |
---|
935 | = ::boost::parameter::keyword<tag::<em>name</em>>::instance; |
---|
936 | </pre> |
---|
937 | </div> |
---|
938 | <div class="section"> |
---|
939 | <h2><a class="toc-backref" href="#id53" id="boost-parameter-template-keyword-name" name="boost-parameter-template-keyword-name">6.5 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</span></tt></a></h2> |
---|
940 | <p>Expands to:</p> |
---|
941 | <pre class="literal-block"> |
---|
942 | namespace tag |
---|
943 | { |
---|
944 | struct <em>name</em>; |
---|
945 | } |
---|
946 | |
---|
947 | template <class T> |
---|
948 | struct <em>name</em> |
---|
949 | : ::boost::parameter::template_keyword<tag::<em>name</em>, T> |
---|
950 | {}; |
---|
951 | </pre> |
---|
952 | </div> |
---|
953 | <div class="section"> |
---|
954 | <h2><a class="toc-backref" href="#id54" id="boost-parameter-fun-r-n-l-h-p" name="boost-parameter-fun-r-n-l-h-p">6.6 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUN(r,n,l,h,p)</span></tt></a></h2> |
---|
955 | <div class="admonition-deprecated admonition"> |
---|
956 | <p class="first admonition-title">Deprecated</p> |
---|
957 | <p class="last">This macro has been deprecated in favor of |
---|
958 | <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION</span></tt>.</p> |
---|
959 | </div> |
---|
960 | <p>Generates a sequence of <a class="reference" href="index.html#forwarding-functions">forwarding function</a> templates named |
---|
961 | <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>, |
---|
962 | and using <tt class="docutils literal"><span class="pre">p</span></tt> to control overload resolution and assign tags to |
---|
963 | positional arguments.</p> |
---|
964 | <table class="docutils field-list" frame="void" rules="none"> |
---|
965 | <col class="field-name" /> |
---|
966 | <col class="field-body" /> |
---|
967 | <tbody valign="top"> |
---|
968 | <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> |
---|
969 | </tr> |
---|
970 | </tbody> |
---|
971 | </table> |
---|
972 | <table class="docutils field-list" frame="void" rules="none"> |
---|
973 | <col class="field-name" /> |
---|
974 | <col class="field-body" /> |
---|
975 | <tbody valign="top"> |
---|
976 | <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 |
---|
977 | that <tt class="docutils literal"><span class="pre">l</span></tt> < <tt class="docutils literal"><span class="pre">h</span></tt></td> |
---|
978 | </tr> |
---|
979 | </tbody> |
---|
980 | </table> |
---|
981 | <dl class="docutils"> |
---|
982 | <dt>Generates</dt> |
---|
983 | <dd><pre class="first last literal-block"> |
---|
984 | template <class A1, class A2, …class A##<strong>l</strong>> |
---|
985 | r name( |
---|
986 | A1 const& a1, A2 const& a2, …A<strong>l</strong> const& x<strong>l</strong> |
---|
987 | , typename <strong>p</strong>::match<A1,A2,…A<strong>l</strong>>::type p = <strong>p</strong>()) |
---|
988 | { |
---|
989 | return <strong>name</strong>_with_named_params(<strong>p</strong>(x1,x2,…x<strong>l</strong>)); |
---|
990 | } |
---|
991 | |
---|
992 | 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>)> |
---|
993 | r name( |
---|
994 | A1 const& a1, A2 const& a2, …A<strong>l</strong> const& x<strong>l</strong> |
---|
995 | , 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>) |
---|
996 | , 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>()) |
---|
997 | { |
---|
998 | 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>))); |
---|
999 | } |
---|
1000 | |
---|
1001 | <span class="vellipsis">⋮</span> |
---|
1002 | |
---|
1003 | template <class A1, class A2, …class A<strong>h</strong>> |
---|
1004 | r name( |
---|
1005 | A1 const& a1, A2 const& a2, …A<strong>h</strong> const& x<strong>h</strong> |
---|
1006 | , typename <strong>p</strong>::match<A1,A2,…A<strong>h</strong>>::type p = <strong>p</strong>()) |
---|
1007 | { |
---|
1008 | return <strong>name</strong>_with_named_params(<strong>p</strong>(a1,a2,…a<strong>h</strong>)); |
---|
1009 | } |
---|
1010 | </pre> |
---|
1011 | </dd> |
---|
1012 | </dl> |
---|
1013 | </div> |
---|
1014 | <div class="section"> |
---|
1015 | <h2><a class="toc-backref" href="#id55" id="boost-parameter-keyword-n-k" name="boost-parameter-keyword-n-k">6.7 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_KEYWORD(n,k)</span></tt></a></h2> |
---|
1016 | <div class="admonition-deprecated admonition"> |
---|
1017 | <p class="first admonition-title">Deprecated</p> |
---|
1018 | <p class="last">This macro has been deprecated in favor of |
---|
1019 | <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_NAME</span></tt>.</p> |
---|
1020 | </div> |
---|
1021 | <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 |
---|
1022 | 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 |
---|
1023 | the enclosing namespace.</p> |
---|
1024 | <table class="docutils field-list" frame="void" rules="none"> |
---|
1025 | <col class="field-name" /> |
---|
1026 | <col class="field-body" /> |
---|
1027 | <tbody valign="top"> |
---|
1028 | <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> |
---|
1029 | </tr> |
---|
1030 | </tbody> |
---|
1031 | </table> |
---|
1032 | <dl class="docutils"> |
---|
1033 | <dt>Generates</dt> |
---|
1034 | <dd><pre class="first last literal-block"> |
---|
1035 | namespace <strong>n</strong> { struct <strong>k</strong>; } |
---|
1036 | namespace { |
---|
1037 | boost::parameter::keyword<<em>tag-namespace</em>::<strong>k</strong>>& <strong>k</strong> |
---|
1038 | = boost::parameter::keyword<<em>tag-namespace</em>::<strong>k</strong>>::get(); |
---|
1039 | } |
---|
1040 | </pre> |
---|
1041 | </dd> |
---|
1042 | </dl> |
---|
1043 | </div> |
---|
1044 | <div class="section"> |
---|
1045 | <h2><a class="toc-backref" href="#id56" id="boost-parameter-match-p-a-x" name="boost-parameter-match-p-a-x">6.8 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MATCH(p,a,x)</span></tt></a></h2> |
---|
1046 | <p>Generates a defaulted parameter declaration for a <a class="reference" href="index.html#forwarding-functions">forwarding |
---|
1047 | function</a>.</p> |
---|
1048 | <table class="docutils field-list" frame="void" rules="none"> |
---|
1049 | <col class="field-name" /> |
---|
1050 | <col class="field-body" /> |
---|
1051 | <tbody valign="top"> |
---|
1052 | <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> |
---|
1053 | </tr> |
---|
1054 | </tbody> |
---|
1055 | </table> |
---|
1056 | <table class="docutils field-list" frame="void" rules="none"> |
---|
1057 | <col class="field-name" /> |
---|
1058 | <col class="field-body" /> |
---|
1059 | <tbody valign="top"> |
---|
1060 | <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> |
---|
1061 | of the form</p> |
---|
1062 | <pre class="last literal-block"> |
---|
1063 | (A0)(A1)…(A<em>n</em>) |
---|
1064 | </pre> |
---|
1065 | </td> |
---|
1066 | </tr> |
---|
1067 | </tbody> |
---|
1068 | </table> |
---|
1069 | <dl class="docutils"> |
---|
1070 | <dt>Generates</dt> |
---|
1071 | <dd><pre class="first last literal-block"> |
---|
1072 | typename <strong>p</strong>::match<<strong>A0</strong>,<strong>A1</strong>…,<strong>A</strong><em>n</em>>::type <strong>x</strong> = <strong>p</strong>() |
---|
1073 | </pre> |
---|
1074 | </dd> |
---|
1075 | </dl> |
---|
1076 | </div> |
---|
1077 | </div> |
---|
1078 | <div class="section"> |
---|
1079 | <h1><a class="toc-backref" href="#id57" id="configuration-macros" name="configuration-macros">7 Configuration Macros</a></h1> |
---|
1080 | <div class="section"> |
---|
1081 | <h2><a class="toc-backref" href="#id58" id="boost-parameter-max-arity" name="boost-parameter-max-arity">7.1 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MAX_ARITY</span></tt></a></h2> |
---|
1082 | <p>Determines the maximum number of arguments supported by the |
---|
1083 | library. Will only be <tt class="docutils literal"><span class="pre">#defined</span></tt> by the library if it is not |
---|
1084 | already <tt class="docutils literal"><span class="pre">#defined</span></tt>.</p> |
---|
1085 | <table class="docutils field-list" frame="void" rules="none"> |
---|
1086 | <col class="field-name" /> |
---|
1087 | <col class="field-body" /> |
---|
1088 | <tbody valign="top"> |
---|
1089 | <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> |
---|
1090 | </tr> |
---|
1091 | </tbody> |
---|
1092 | </table> |
---|
1093 | <table class="docutils field-list" frame="void" rules="none"> |
---|
1094 | <col class="field-name" /> |
---|
1095 | <col class="field-body" /> |
---|
1096 | <tbody valign="top"> |
---|
1097 | <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> |
---|
1098 | </tr> |
---|
1099 | </tbody> |
---|
1100 | </table> |
---|
1101 | </div> |
---|
1102 | </div> |
---|
1103 | <div class="section"> |
---|
1104 | <h1><a class="toc-backref" href="#id59" id="tutorial" name="tutorial">8 Tutorial</a></h1> |
---|
1105 | <p>Follow <a class="reference" href="index.html#tutorial">this link</a> to the Boost.Parameter tutorial |
---|
1106 | documentation.</p> |
---|
1107 | <hr class="docutils" /> |
---|
1108 | <table class="docutils footnote" frame="void" id="thread" rules="none"> |
---|
1109 | <colgroup><col class="label" /><col /></colgroup> |
---|
1110 | <tbody valign="top"> |
---|
1111 | <tr><td class="label"><a class="fn-backref" href="#id2" name="thread">[1]</a></td><td>References to tag objects may be initialized multiple |
---|
1112 | times. This scenario can only occur in the presence of |
---|
1113 | threading. Because the C++ standard doesn't consider threading, |
---|
1114 | it doesn't explicitly allow or forbid multiple initialization of |
---|
1115 | references. That said, it's hard to imagine an implementation |
---|
1116 | where it could make a difference.</td></tr> |
---|
1117 | </tbody> |
---|
1118 | </table> |
---|
1119 | <table class="docutils footnote" frame="void" id="no-result-of" rules="none"> |
---|
1120 | <colgroup><col class="label" /><col /></colgroup> |
---|
1121 | <tbody valign="top"> |
---|
1122 | <tr><td class="label"><a name="no-result-of">[2]</a></td><td><em>(<a class="fn-backref" href="#id11">1</a>, <a class="fn-backref" href="#id18">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>, |
---|
1123 | <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 |
---|
1124 | <tt class="docutils literal"><span class="pre">F::result_type</span></tt>.</td></tr> |
---|
1125 | </tbody> |
---|
1126 | </table> |
---|
1127 | </div> |
---|
1128 | </div> |
---|
1129 | <div class="footer"> |
---|
1130 | <hr class="footer" /> |
---|
1131 | Generated on: 2007-05-03 14:17 UTC. |
---|
1132 | 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. |
---|
1133 | |
---|
1134 | </div> |
---|
1135 | </body> |
---|
1136 | </html> |
---|