mirror of
https://github.com/boostorg/parameter.git
synced 2026-01-20 16:52:13 +00:00
Compare commits
147 Commits
boost-1.42
...
sandbox-br
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d741f6ff2f | ||
|
|
23ed477c44 | ||
|
|
6427d82103 | ||
|
|
436209fa82 | ||
|
|
9d66bd7632 | ||
|
|
0b0ce28a8a | ||
|
|
15d8701d77 | ||
|
|
ee32bc6f67 | ||
|
|
c2177b122c | ||
|
|
359b3a5c3a | ||
|
|
522c1e33b0 | ||
|
|
298108e7ed | ||
|
|
ae3bfbad46 | ||
|
|
d8a61e4df7 | ||
|
|
82b5cc0208 | ||
|
|
91623e6241 | ||
|
|
4af5c63d46 | ||
|
|
1c2f56c672 | ||
|
|
08b0a74035 | ||
|
|
4c8725641d | ||
|
|
b91cd816c8 | ||
|
|
f9a2fba9ab | ||
|
|
55792af45f | ||
|
|
e054a75533 | ||
|
|
834f245953 | ||
|
|
ef9dfeb2d1 | ||
|
|
98bcbbad78 | ||
|
|
d9f0e42397 | ||
|
|
0a26a05500 | ||
|
|
2e725894c6 | ||
|
|
a4b2742095 | ||
|
|
2af6d0439e | ||
|
|
276d786ed9 | ||
|
|
7689b5b9d0 | ||
|
|
a28883d9ad | ||
|
|
45bac7b579 | ||
|
|
e4e6ba52c4 | ||
|
|
6bb4b0ef8b | ||
|
|
e0416b8343 | ||
|
|
f8a1b652bc | ||
|
|
f7611b8a1f | ||
|
|
493a8b28a5 | ||
|
|
32ec272b6d | ||
|
|
4c8c0cce93 | ||
|
|
8fc7ba81cc | ||
|
|
5b2b1a47f8 | ||
|
|
f3764c539e | ||
|
|
b67fbdff8f | ||
|
|
0e263f5602 | ||
|
|
3c815b31fe | ||
|
|
dbbe37b8c1 | ||
|
|
ce712b8f30 | ||
|
|
913fa2eb44 | ||
|
|
12c873d3e4 | ||
|
|
164c48c018 | ||
|
|
2ac8833532 | ||
|
|
6556e278c6 | ||
|
|
1a9e89cb8d | ||
|
|
6d53a2b914 | ||
|
|
c7296b9a05 | ||
|
|
6a5d61ce3c | ||
|
|
e887f199e0 | ||
|
|
e7bd42b07a | ||
|
|
b9248d774f | ||
|
|
763a09c5aa | ||
|
|
07987bc97c | ||
|
|
b59c238a83 | ||
|
|
9dfa5a8d9e | ||
|
|
3d0bdf694c | ||
|
|
b5c6e05ea0 | ||
|
|
cc2a478afc | ||
|
|
1dab8a1008 | ||
|
|
4facdaafc3 | ||
|
|
5190f65321 | ||
|
|
0335832574 | ||
|
|
b9f287ea52 | ||
|
|
28f98ecbf0 | ||
|
|
4e8c8ced0f | ||
|
|
5baef32925 | ||
|
|
cc8ca29980 | ||
|
|
e2405e2d00 | ||
|
|
1cba9bd634 | ||
|
|
e58e928af4 | ||
|
|
c3e842fc4c | ||
|
|
ab57984c04 | ||
|
|
a8dc2bbd25 | ||
|
|
bb838edb2f | ||
|
|
74b777612e | ||
|
|
ea4457878c | ||
|
|
1f3fb08086 | ||
|
|
702ca6af6e | ||
|
|
225a38b68a | ||
|
|
de756246e7 | ||
|
|
de67d5fe6d | ||
|
|
40332972ca | ||
|
|
47292301e7 | ||
|
|
7a5a21dacc | ||
|
|
04aaeef41d | ||
|
|
5a0bad4224 | ||
|
|
07f167eed3 | ||
|
|
b34aa49ceb | ||
|
|
f5dbd06b32 | ||
|
|
9bcd7c2fec | ||
|
|
7f2abce0d4 | ||
|
|
b7036ee04f | ||
|
|
36d25230e6 | ||
|
|
d298a327b5 | ||
|
|
8162166037 | ||
|
|
dbcf8de808 | ||
|
|
07893af4c5 | ||
|
|
2070231553 | ||
|
|
5b1971f1ef | ||
|
|
988bb4b365 | ||
|
|
64bfddc3a7 | ||
|
|
2a0397c1b2 | ||
|
|
decd9ac9fd | ||
|
|
a181afc699 | ||
|
|
a6db5788f6 | ||
|
|
d37e7cd513 | ||
|
|
6dd64214c2 | ||
|
|
96d3e0fd07 | ||
|
|
ac398b0e50 | ||
|
|
3f1f0657f6 | ||
|
|
abae0c8d21 | ||
|
|
892a599999 | ||
|
|
acbf69fdb6 | ||
|
|
566e886887 | ||
|
|
ae05e30eac | ||
|
|
310998435c | ||
|
|
647265bfd3 | ||
|
|
76af708b1f | ||
|
|
deb606ef59 | ||
|
|
721b294842 | ||
|
|
f40418cf9a | ||
|
|
b12dbd9f6a | ||
|
|
6087feef11 | ||
|
|
e7d652f208 | ||
|
|
51c3dd4cb1 | ||
|
|
8cf35658bd | ||
|
|
ee2b252418 | ||
|
|
45d320a434 | ||
|
|
76067ad5d2 | ||
|
|
15b0729181 | ||
|
|
23d30d9ea6 | ||
|
|
012e0abd22 | ||
|
|
225ee5072e | ||
|
|
384add2571 |
17
doc/README.txt
Normal file
17
doc/README.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
.. -*-rst-*-
|
||||
|
||||
.. Copyright David Abrahams 2009. 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)
|
||||
|
||||
To build the html::
|
||||
|
||||
bjam html
|
||||
|
||||
To test the code in this documentation:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
python ../../../tools/litre/tool.py `pwd`/index.rst --dump_dir=../test/literate
|
||||
cd ../test/literate
|
||||
bjam
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,12 +3,12 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.7: http://docutils.sourceforge.net/" />
|
||||
<title>The Boost Parameter Library Python Binding Documentation</title>
|
||||
<meta name="authors" content="Daniel Wallin" />
|
||||
<meta name="organization" content="Boost Consulting" />
|
||||
<meta name="date" content="2008-03-22" />
|
||||
<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)" />
|
||||
<meta name="authors" content="David Abrahams Daniel Wallin" />
|
||||
<meta name="organization" content="BoostPro Computing" />
|
||||
<meta name="date" content="2009-01-29" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Daniel Wallin 2005-2009. 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)" />
|
||||
<link rel="stylesheet" href="rst.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
@@ -19,16 +19,17 @@
|
||||
<col class="docinfo-content" />
|
||||
<tbody valign="top">
|
||||
<tr><th class="docinfo-name">Authors:</th>
|
||||
<td>Daniel Wallin</td></tr>
|
||||
<td>David Abrahams
|
||||
<br />Daniel Wallin</td></tr>
|
||||
<tr><th class="docinfo-name">Contact:</th>
|
||||
<td><a class="first last reference external" href="mailto:dalwan01@student.umu.se">dalwan01@student.umu.se</a></td></tr>
|
||||
<td><a class="first reference external" href="mailto:dave@boost-consulting.com">dave@boost-consulting.com</a>, <a class="last reference external" href="mailto:daniel@boostpro.com">daniel@boostpro.com</a></td></tr>
|
||||
<tr><th class="docinfo-name">Organization:</th>
|
||||
<td><a class="first last reference external" href="http://www.boost-consulting.com">Boost Consulting</a></td></tr>
|
||||
<td><a class="first last reference external" href="http://www.boostpro.com">BoostPro Computing</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2008-03-22</td></tr>
|
||||
<td>2009-01-29</td></tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
<td>Copyright David Abrahams, Daniel Wallin
|
||||
2005. Distributed under the Boost Software License,
|
||||
2005-2009. Distributed under the Boost Software License,
|
||||
Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||
or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</td></tr>
|
||||
</tbody>
|
||||
@@ -46,18 +47,18 @@ functions, operators and constructors to Python.</p>
|
||||
<li><a class="reference internal" href="#tutorial" id="id8">Tutorial</a></li>
|
||||
<li><a class="reference internal" href="#concept-parameterspec" id="id9">concept <span class="concept">ParameterSpec</span></a></li>
|
||||
<li><a class="reference internal" href="#special-keywords" id="id10"><em>special</em> keywords</a></li>
|
||||
<li><a class="reference internal" href="#class-template-init" id="id11">class template <tt class="docutils literal"><span class="pre">init</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#class-template-call" id="id12">class template <tt class="docutils literal"><span class="pre">call</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#class-template-function" id="id13">class template <tt class="docutils literal"><span class="pre">function</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#function-template-def" id="id14">function template <tt class="docutils literal"><span class="pre">def</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#class-template-init" id="id11">class template <tt class="docutils literal">init</tt></a></li>
|
||||
<li><a class="reference internal" href="#class-template-call" id="id12">class template <tt class="docutils literal">call</tt></a></li>
|
||||
<li><a class="reference internal" href="#class-template-function" id="id13">class template <tt class="docutils literal">function</tt></a></li>
|
||||
<li><a class="reference internal" href="#function-template-def" id="id14">function template <tt class="docutils literal">def</tt></a></li>
|
||||
<li><a class="reference internal" href="#portability" id="id15">Portability</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="introduction">
|
||||
<h1><a class="toc-backref" href="#id7">Introduction</a></h1>
|
||||
<p><tt class="docutils literal"><span class="pre">boost/parameter/python.hpp</span></tt> introduces a group of <a class="reference external" href="../../../python/doc/v2/def_visitor.html"><tt class="docutils literal"><span class="pre">def_visitors</span></tt></a> that can
|
||||
<p><tt class="docutils literal">boost/parameter/python.hpp</tt> introduces a group of <a class="reference external" href="../../../python/doc/v2/def_visitor.html"><tt class="docutils literal">def_visitors</tt></a> that can
|
||||
be used to easily expose Boost.Parameter-enabled member functions to Python with
|
||||
Boost.Python. It also provides a function template <tt class="docutils literal"><span class="pre">def()</span></tt> that can be used
|
||||
Boost.Python. It also provides a function template <tt class="docutils literal">def()</tt> that can be used
|
||||
to expose Boost.Parameter-enabled free functions.</p>
|
||||
<p>When binding a Boost.Parameter enabled function, the keyword tags
|
||||
must be specified. Additionally, because Boost.Parameter enabled
|
||||
@@ -118,10 +119,10 @@ assert(title == "foo");
|
||||
assert(height == 20);
|
||||
assert(width == 400);
|
||||
''') -->
|
||||
<p>It defines a set of overloaded member functions called <tt class="docutils literal"><span class="pre">open</span></tt> with one
|
||||
<p>It defines a set of overloaded member functions called <tt class="docutils literal">open</tt> with one
|
||||
required parameter and two optional ones. To bind this member function to
|
||||
Python we use the binding utility <tt class="docutils literal"><span class="pre">boost::parameter::python::function</span></tt>.
|
||||
<tt class="docutils literal"><span class="pre">boost::parameter::python::function</span></tt> is a <a class="reference external" href="../../../python/doc/v2/def_visitor.html"><tt class="docutils literal"><span class="pre">def_visitor</span></tt></a> that we'll instantiate
|
||||
<tt class="docutils literal"><span class="pre">boost::parameter::python::function</span></tt> is a <a class="reference external" href="../../../python/doc/v2/def_visitor.html"><tt class="docutils literal">def_visitor</tt></a> that we'll instantiate
|
||||
and pass to <tt class="docutils literal"><span class="pre">boost::python::class_::def()</span></tt>.</p>
|
||||
<p>To use <tt class="docutils literal"><span class="pre">boost::parameter::python::function</span></tt> we first need to define
|
||||
a class with forwarding overloads. This is needed because <tt class="docutils literal"><span class="pre">window::open()</span></tt>
|
||||
@@ -189,8 +190,8 @@ forwarding overloads that we defined earlier. The second one is an <a class="ref
|
||||
Sequence</a> with the keyword tag types and argument types for the function
|
||||
specified as function types. The pointer syntax used in <tt class="docutils literal"><span class="pre">tag::width*</span></tt> and
|
||||
<tt class="docutils literal"><span class="pre">tag::height*</span></tt> means that the parameter is optional. The first element of
|
||||
the <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL Sequence</a> is the return type of the function, in this case <tt class="docutils literal"><span class="pre">void</span></tt>,
|
||||
which is passed as the first argument to <tt class="docutils literal"><span class="pre">operator()</span></tt> in the forwarding
|
||||
the <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL Sequence</a> is the return type of the function, in this case <tt class="docutils literal">void</tt>,
|
||||
which is passed as the first argument to <tt class="docutils literal">operator()</tt> in the forwarding
|
||||
class.</p>
|
||||
<!-- The
|
||||
pointer syntax means that the parameter is optional, so in this case
|
||||
@@ -244,24 +245,24 @@ types instead). -->
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="concept-parameterspec">
|
||||
<h1><a class="toc-backref" href="#id9">concept <span class="concept">ParameterSpec</span></a></h1>
|
||||
<p>A <span class="concept">ParameterSpec</span> is a function type <tt class="docutils literal"><span class="pre">K(T)</span></tt> that describes both the keyword tag,
|
||||
<tt class="docutils literal"><span class="pre">K</span></tt>, and the argument type, <tt class="docutils literal"><span class="pre">T</span></tt>, for a parameter.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">K</span></tt> is either:</p>
|
||||
<p>A <span class="concept">ParameterSpec</span> is a function type <tt class="docutils literal">K(T)</tt> that describes both the keyword tag,
|
||||
<tt class="docutils literal">K</tt>, and the argument type, <tt class="docutils literal">T</tt>, for a parameter.</p>
|
||||
<p><tt class="docutils literal">K</tt> is either:</p>
|
||||
<ul class="simple">
|
||||
<li>A <em>required</em> keyword of the form <tt class="docutils literal"><span class="pre">Tag</span></tt></li>
|
||||
<li><strong>or</strong>, an <em>optional</em> keyword of the form <tt class="docutils literal"><span class="pre">Tag*</span></tt></li>
|
||||
<li><strong>or</strong>, a <em>special</em> keyword of the form <tt class="docutils literal"><span class="pre">Tag**</span></tt></li>
|
||||
<li>A <em>required</em> keyword of the form <tt class="docutils literal">Tag</tt></li>
|
||||
<li><strong>or</strong>, an <em>optional</em> keyword of the form <tt class="docutils literal">Tag*</tt></li>
|
||||
<li><strong>or</strong>, a <em>special</em> keyword of the form <tt class="docutils literal">Tag**</tt></li>
|
||||
</ul>
|
||||
<p>where <tt class="docutils literal"><span class="pre">Tag</span></tt> is a keyword tag type, as used in a specialization
|
||||
<p>where <tt class="docutils literal">Tag</tt> is a keyword tag type, as used in a specialization
|
||||
of <a class="reference external" href="../../../parameter/doc/html/reference.html#keyword"><tt class="docutils literal"><span class="pre">boost::parameter::keyword</span></tt></a>.</p>
|
||||
<p>The <strong>arity range</strong> for an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL Sequence</a> of <span class="concept">ParameterSpec</span>'s is
|
||||
defined as the closed range:</p>
|
||||
<pre class="literal-block">
|
||||
[ mpl::size<S> - number of <em>special</em> keyword tags in <tt class="docutils literal"><span class="pre">S</span></tt>, mpl::size<S> ]
|
||||
[ mpl::size<S> - number of <em>special</em> keyword tags in <tt class="docutils literal">S</tt>, mpl::size<S> ]
|
||||
</pre>
|
||||
<p>For example, the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2<x(int),y(int)></span></tt> is <tt class="docutils literal"><span class="pre">[2,2]</span></tt>,
|
||||
the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2<x(int),y*(int)></span></tt> is <tt class="docutils literal"><span class="pre">[2,2]</span></tt> and the
|
||||
<strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2<x(int),y**(int)></span></tt> is <tt class="docutils literal"><span class="pre">[1,2]</span></tt>.</p>
|
||||
<p>For example, the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2<x(int),y(int)></span></tt> is <tt class="docutils literal">[2,2]</tt>,
|
||||
the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2<x(int),y*(int)></span></tt> is <tt class="docutils literal">[2,2]</tt> and the
|
||||
<strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2<x(int),y**(int)></span></tt> is <tt class="docutils literal">[1,2]</tt>.</p>
|
||||
</div>
|
||||
<div class="section" id="special-keywords">
|
||||
<h1><a class="toc-backref" href="#id10"><em>special</em> keywords</a></h1>
|
||||
@@ -318,20 +319,20 @@ int main()
|
||||
}''') -->
|
||||
<!-- @build() -->
|
||||
<!-- .. _example: index.html#dispatching-based-on-the-presence-of-a-default -->
|
||||
<p>In the above example the type of the default for <tt class="docutils literal"><span class="pre">color</span></tt> is <tt class="docutils literal"><span class="pre">mpl::false_</span></tt>, a
|
||||
<p>In the above example the type of the default for <tt class="docutils literal">color</tt> is <tt class="docutils literal"><span class="pre">mpl::false_</span></tt>, a
|
||||
type that is distinct from any color map that the user might supply.</p>
|
||||
<p>When binding the case outlined above, the default type for <tt class="docutils literal"><span class="pre">color</span></tt> will not
|
||||
be convertible to the parameter type. Therefore we need to tag the <tt class="docutils literal"><span class="pre">color</span></tt>
|
||||
<p>When binding the case outlined above, the default type for <tt class="docutils literal">color</tt> will not
|
||||
be convertible to the parameter type. Therefore we need to tag the <tt class="docutils literal">color</tt>
|
||||
keyword as a <em>special</em> keyword. This is done by specifying the tag as
|
||||
<tt class="docutils literal"><span class="pre">tag::color**</span></tt> when binding the function (see <a class="reference internal" href="#concept-parameterspec">concept ParameterSpec</a> for
|
||||
more details on the tagging). By doing this we tell the binding functions that
|
||||
it needs to generate two overloads, one with the <tt class="docutils literal"><span class="pre">color</span></tt> parameter present
|
||||
it needs to generate two overloads, one with the <tt class="docutils literal">color</tt> parameter present
|
||||
and one without. Had there been two <em>special</em> keywords, four overloads would
|
||||
need to be generated. The number of generated overloads is equal to 2<sup>N</sup>, where <tt class="docutils literal"><span class="pre">N</span></tt> is the number of <em>special</em> keywords.</p>
|
||||
need to be generated. The number of generated overloads is equal to 2<sup>N</sup>, where <tt class="docutils literal">N</tt> is the number of <em>special</em> keywords.</p>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="class-template-init">
|
||||
<h1><a class="toc-backref" href="#id11">class template <tt class="docutils literal"><span class="pre">init</span></tt></a></h1>
|
||||
<h1><a class="toc-backref" href="#id11">class template <tt class="docutils literal">init</tt></a></h1>
|
||||
<p>Defines a named parameter enabled constructor.</p>
|
||||
<pre class="literal-block">
|
||||
template <class ParameterSpecs>
|
||||
@@ -346,13 +347,13 @@ struct init : python::def_visitor<init<ParameterSpecs> >
|
||||
</pre>
|
||||
<!-- @ignore() -->
|
||||
<div class="section" id="init-requirements">
|
||||
<h2><tt class="docutils literal"><span class="pre">init</span></tt> requirements</h2>
|
||||
<h2><tt class="docutils literal">init</tt> requirements</h2>
|
||||
<ul>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element is a
|
||||
<li><p class="first"><tt class="docutils literal">ParameterSpecs</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element is a
|
||||
model of <span class="concept">ParameterSpec</span>.</p>
|
||||
</li>
|
||||
<li><p class="first">For every <tt class="docutils literal"><span class="pre">N</span></tt> in <tt class="docutils literal"><span class="pre">[U,V]</span></tt>, where <tt class="docutils literal"><span class="pre">[U,V]</span></tt> is the <strong>arity
|
||||
range</strong> of <tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt>, <tt class="docutils literal"><span class="pre">Class</span></tt> must support these
|
||||
<li><p class="first">For every <tt class="docutils literal">N</tt> in <tt class="docutils literal">[U,V]</tt>, where <tt class="docutils literal">[U,V]</tt> is the <strong>arity
|
||||
range</strong> of <tt class="docutils literal">ParameterSpecs</tt>, <tt class="docutils literal">Class</tt> must support these
|
||||
expressions:</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
@@ -370,11 +371,11 @@ expressions:</p>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">Class(a0,</span> <span class="pre">…,</span> <span class="pre">aN)</span></tt></p>
|
||||
<tr><td><p class="first last"><tt class="docutils literal">Class(a0, …, aN)</tt></p>
|
||||
</td>
|
||||
<td><p class="first last">-</p>
|
||||
</td>
|
||||
<td><p class="first last"><tt class="docutils literal"><span class="pre">a0</span></tt>…<tt class="docutils literal"><span class="pre">aN</span></tt> are tagged arguments.</p>
|
||||
<td><p class="first last"><tt class="docutils literal">a0</tt>…<tt class="docutils literal">aN</tt> are tagged arguments.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -383,8 +384,8 @@ expressions:</p>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="template-class-callpolicies-operator-callpolicies-const">
|
||||
<h2><tt class="docutils literal"><span class="pre">template</span> <span class="pre"><class</span> <span class="pre">CallPolicies></span> <span class="pre">operator[](CallPolicies</span> <span class="pre">const&)</span></tt></h2>
|
||||
<p>Returns a <tt class="docutils literal"><span class="pre">def_visitor</span></tt> equivalent to <tt class="docutils literal"><span class="pre">*this</span></tt>, except that it
|
||||
<h2><tt class="docutils literal">template <class CallPolicies> <span class="pre">operator[](CallPolicies</span> const&)</tt></h2>
|
||||
<p>Returns a <tt class="docutils literal">def_visitor</tt> equivalent to <tt class="docutils literal">*this</tt>, except that it
|
||||
uses CallPolicies when creating the binding.</p>
|
||||
</div>
|
||||
<div class="section" id="example">
|
||||
@@ -447,8 +448,8 @@ assert(args[y | 1] == 1);
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="class-template-call">
|
||||
<h1><a class="toc-backref" href="#id12">class template <tt class="docutils literal"><span class="pre">call</span></tt></a></h1>
|
||||
<p>Defines a <tt class="docutils literal"><span class="pre">__call__</span></tt> operator, mapped to <tt class="docutils literal"><span class="pre">operator()</span></tt> in C++.</p>
|
||||
<h1><a class="toc-backref" href="#id12">class template <tt class="docutils literal">call</tt></a></h1>
|
||||
<p>Defines a <tt class="docutils literal">__call__</tt> operator, mapped to <tt class="docutils literal">operator()</tt> in C++.</p>
|
||||
<pre class="literal-block">
|
||||
template <class ParameterSpecs>
|
||||
struct call : python::def_visitor<call<ParameterSpecs> >
|
||||
@@ -462,14 +463,14 @@ struct call : python::def_visitor<call<ParameterSpecs> >
|
||||
</pre>
|
||||
<!-- @ignore() -->
|
||||
<div class="section" id="call-requirements">
|
||||
<h2><tt class="docutils literal"><span class="pre">call</span></tt> requirements</h2>
|
||||
<h2><tt class="docutils literal">call</tt> requirements</h2>
|
||||
<ul>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
|
||||
<li><p class="first"><tt class="docutils literal">ParameterSpecs</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
|
||||
except the first models <span class="concept">ParameterSpec</span>. The first element
|
||||
is the result type of <tt class="docutils literal"><span class="pre">c(…)</span></tt>.</p>
|
||||
</li>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">Class</span></tt> must support these expressions, where <tt class="docutils literal"><span class="pre">c</span></tt> is an
|
||||
instance of <tt class="docutils literal"><span class="pre">Class</span></tt>:</p>
|
||||
<li><p class="first"><tt class="docutils literal">Class</tt> must support these expressions, where <tt class="docutils literal">c</tt> is an
|
||||
instance of <tt class="docutils literal">Class</tt>:</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="24%" />
|
||||
@@ -486,22 +487,22 @@ instance of <tt class="docutils literal"><span class="pre">Class</span></tt>:</p
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">c(a0,</span> <span class="pre">…,</span> <span class="pre">aN)</span></tt></p>
|
||||
<tr><td><p class="first last"><tt class="docutils literal">c(a0, …, aN)</tt></p>
|
||||
</td>
|
||||
<td><p class="first last">Convertible to <tt class="docutils literal"><span class="pre">R</span></tt></p>
|
||||
<td><p class="first last">Convertible to <tt class="docutils literal">R</tt></p>
|
||||
</td>
|
||||
<td><p class="first last"><tt class="docutils literal"><span class="pre">a0</span></tt>…<tt class="docutils literal"><span class="pre">aN</span></tt> are tagged arguments.</p>
|
||||
<td><p class="first last"><tt class="docutils literal">a0</tt>…<tt class="docutils literal">aN</tt> are tagged arguments.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>For every <tt class="docutils literal"><span class="pre">N</span></tt> in <tt class="docutils literal"><span class="pre">[U,V]</span></tt>, where <tt class="docutils literal"><span class="pre">[U,V]</span></tt> is the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt>.</p>
|
||||
<p>For every <tt class="docutils literal">N</tt> in <tt class="docutils literal">[U,V]</tt>, where <tt class="docutils literal">[U,V]</tt> is the <strong>arity range</strong> of <tt class="docutils literal">ParameterSpecs</tt>.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="id3">
|
||||
<h2><tt class="docutils literal"><span class="pre">template</span> <span class="pre"><class</span> <span class="pre">CallPolicies></span> <span class="pre">operator[](CallPolicies</span> <span class="pre">const&)</span></tt></h2>
|
||||
<p>Returns a <tt class="docutils literal"><span class="pre">def_visitor</span></tt> equivalent to <tt class="docutils literal"><span class="pre">*this</span></tt>, except that it
|
||||
<h2><tt class="docutils literal">template <class CallPolicies> <span class="pre">operator[](CallPolicies</span> const&)</tt></h2>
|
||||
<p>Returns a <tt class="docutils literal">def_visitor</tt> equivalent to <tt class="docutils literal">*this</tt>, except that it
|
||||
uses CallPolicies when creating the binding.</p>
|
||||
</div>
|
||||
<div class="section" id="id4">
|
||||
@@ -574,7 +575,7 @@ return 0;
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="class-template-function">
|
||||
<h1><a class="toc-backref" href="#id13">class template <tt class="docutils literal"><span class="pre">function</span></tt></a></h1>
|
||||
<h1><a class="toc-backref" href="#id13">class template <tt class="docutils literal">function</tt></a></h1>
|
||||
<p>Defines a named parameter enabled member function.</p>
|
||||
<pre class="literal-block">
|
||||
template <class Fwd, class ParameterSpecs>
|
||||
@@ -586,14 +587,14 @@ struct function : python::def_visitor<function<Fwd, ParameterSpecs> >
|
||||
</pre>
|
||||
<!-- @ignore() -->
|
||||
<div class="section" id="function-requirements">
|
||||
<h2><tt class="docutils literal"><span class="pre">function</span></tt> requirements</h2>
|
||||
<h2><tt class="docutils literal">function</tt> requirements</h2>
|
||||
<ul>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
|
||||
<li><p class="first"><tt class="docutils literal">ParameterSpecs</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
|
||||
except the first models <span class="concept">ParameterSpec</span>. The first element
|
||||
is the result type of <tt class="docutils literal"><span class="pre">c.f(…)</span></tt>, where <tt class="docutils literal"><span class="pre">f</span></tt> is the member
|
||||
is the result type of <tt class="docutils literal"><span class="pre">c.f(…)</span></tt>, where <tt class="docutils literal">f</tt> is the member
|
||||
function.</p>
|
||||
</li>
|
||||
<li><p class="first">An instance of <tt class="docutils literal"><span class="pre">Fwd</span></tt> must support this expression:</p>
|
||||
<li><p class="first">An instance of <tt class="docutils literal">Fwd</tt> must support this expression:</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="39%" />
|
||||
@@ -610,24 +611,24 @@ function.</p>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">fwd(boost::type<R>(),</span> <span class="pre">self,</span> <span class="pre">a0,</span> <span class="pre">…,</span> <span class="pre">aN)</span></tt></p>
|
||||
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">fwd(boost::type<R>(),</span> self, a0, …, aN)</tt></p>
|
||||
</td>
|
||||
<td><p class="first last">Convertible to <tt class="docutils literal"><span class="pre">R</span></tt></p>
|
||||
<td><p class="first last">Convertible to <tt class="docutils literal">R</tt></p>
|
||||
</td>
|
||||
<td><p class="first last"><tt class="docutils literal"><span class="pre">self</span></tt> is a reference to the object on which
|
||||
the function should be invoked. <tt class="docutils literal"><span class="pre">a0</span></tt>…<tt class="docutils literal"><span class="pre">aN</span></tt>
|
||||
<td><p class="first last"><tt class="docutils literal">self</tt> is a reference to the object on which
|
||||
the function should be invoked. <tt class="docutils literal">a0</tt>…<tt class="docutils literal">aN</tt>
|
||||
are tagged arguments.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>For every <tt class="docutils literal"><span class="pre">N</span></tt> in <tt class="docutils literal"><span class="pre">[U,V]</span></tt>, where <tt class="docutils literal"><span class="pre">[U,V]</span></tt> is the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt>.</p>
|
||||
<p>For every <tt class="docutils literal">N</tt> in <tt class="docutils literal">[U,V]</tt>, where <tt class="docutils literal">[U,V]</tt> is the <strong>arity range</strong> of <tt class="docutils literal">ParameterSpecs</tt>.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="id5">
|
||||
<h2>Example</h2>
|
||||
<p>This example exports a member function <tt class="docutils literal"><span class="pre">f(int</span> <span class="pre">x,</span> <span class="pre">int</span> <span class="pre">y</span> <span class="pre">=</span> <span class="pre">…)</span></tt> to Python. The
|
||||
<p>This example exports a member function <tt class="docutils literal">f(int x, int y = …)</tt> to Python. The
|
||||
sequence of <span class="concept">ParameterSpec</span>'s <tt class="docutils literal"><span class="pre">mpl::vector2<tag::x(int),</span> <span class="pre">tag::y*(int)></span></tt> has
|
||||
an <strong>arity range</strong> of [2,2], so we only need one forwarding overload.</p>
|
||||
<pre class="literal-block">
|
||||
@@ -690,7 +691,7 @@ assert(y == 1);
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
<div class="section" id="function-template-def">
|
||||
<h1><a class="toc-backref" href="#id14">function template <tt class="docutils literal"><span class="pre">def</span></tt></a></h1>
|
||||
<h1><a class="toc-backref" href="#id14">function template <tt class="docutils literal">def</tt></a></h1>
|
||||
<p>Defines a named parameter enabled free function in the current Python scope.</p>
|
||||
<pre class="literal-block">
|
||||
template <class Fwd, class ParameterSpecs>
|
||||
@@ -698,13 +699,13 @@ void def(char const* name);
|
||||
</pre>
|
||||
<!-- @ignore() -->
|
||||
<div class="section" id="def-requirements">
|
||||
<h2><tt class="docutils literal"><span class="pre">def</span></tt> requirements</h2>
|
||||
<h2><tt class="docutils literal">def</tt> requirements</h2>
|
||||
<ul>
|
||||
<li><p class="first"><tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
|
||||
<li><p class="first"><tt class="docutils literal">ParameterSpecs</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
|
||||
except the first models <span class="concept">ParameterSpec</span>. The first element
|
||||
is the result type of <tt class="docutils literal"><span class="pre">f(…)</span></tt>, where <tt class="docutils literal"><span class="pre">f</span></tt> is the function.</p>
|
||||
is the result type of <tt class="docutils literal"><span class="pre">f(…)</span></tt>, where <tt class="docutils literal">f</tt> is the function.</p>
|
||||
</li>
|
||||
<li><p class="first">An instance of <tt class="docutils literal"><span class="pre">Fwd</span></tt> must support this expression:</p>
|
||||
<li><p class="first">An instance of <tt class="docutils literal">Fwd</tt> must support this expression:</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="39%" />
|
||||
@@ -721,22 +722,22 @@ is the result type of <tt class="docutils literal"><span class="pre">f(…)</spa
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">fwd(boost::type<R>(),</span> <span class="pre">a0,</span> <span class="pre">…,</span> <span class="pre">aN)</span></tt></p>
|
||||
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">fwd(boost::type<R>(),</span> a0, …, aN)</tt></p>
|
||||
</td>
|
||||
<td><p class="first last">Convertible to <tt class="docutils literal"><span class="pre">R</span></tt></p>
|
||||
<td><p class="first last">Convertible to <tt class="docutils literal">R</tt></p>
|
||||
</td>
|
||||
<td><p class="first last"><tt class="docutils literal"><span class="pre">a0</span></tt>…<tt class="docutils literal"><span class="pre">aN</span></tt> are tagged arguments.</p>
|
||||
<td><p class="first last"><tt class="docutils literal">a0</tt>…<tt class="docutils literal">aN</tt> are tagged arguments.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>For every <tt class="docutils literal"><span class="pre">N</span></tt> in <tt class="docutils literal"><span class="pre">[U,V]</span></tt>, where <tt class="docutils literal"><span class="pre">[U,V]</span></tt> is the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt>.</p>
|
||||
<p>For every <tt class="docutils literal">N</tt> in <tt class="docutils literal">[U,V]</tt>, where <tt class="docutils literal">[U,V]</tt> is the <strong>arity range</strong> of <tt class="docutils literal">ParameterSpecs</tt>.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="id6">
|
||||
<h2>Example</h2>
|
||||
<p>This example exports a function <tt class="docutils literal"><span class="pre">f(int</span> <span class="pre">x,</span> <span class="pre">int</span> <span class="pre">y</span> <span class="pre">=</span> <span class="pre">…)</span></tt> to Python. The
|
||||
<p>This example exports a function <tt class="docutils literal">f(int x, int y = …)</tt> to Python. The
|
||||
sequence of <span class="concept">ParameterSpec</span>'s <tt class="docutils literal"><span class="pre">mpl::vector2<tag::x(int),</span> <span class="pre">tag::y*(int)></span></tt> has
|
||||
an <strong>arity range</strong> of [2,2], so we only need one forwarding overload.</p>
|
||||
<pre class="literal-block">
|
||||
@@ -779,7 +780,7 @@ specialization</em>.</p>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr class="footer" />
|
||||
Generated on: 2008-06-26 21:51 UTC.
|
||||
Generated on: 2011-11-08 21:40 UTC.
|
||||
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
|
||||
</div>
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils 0.7: http://docutils.sourceforge.net/" />
|
||||
<title>The Boost Parameter Library Reference Documentation</title>
|
||||
<meta name="authors" content="David Abrahams Daniel Wallin" />
|
||||
<meta name="organization" content="Boost Consulting" />
|
||||
<meta name="organization" content="BoostPro Computing" />
|
||||
<meta name="date" content="2005-07-17" />
|
||||
<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)" />
|
||||
<meta name="copyright" content="Copyright David Abrahams, Daniel Wallin 2005-2009. 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)" />
|
||||
<link rel="stylesheet" href="rst.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
@@ -22,14 +22,14 @@
|
||||
<td>David Abrahams
|
||||
<br />Daniel Wallin</td></tr>
|
||||
<tr><th class="docinfo-name">Contact:</th>
|
||||
<td><a class="first reference external" href="mailto:dave@boost-consulting.com">dave@boost-consulting.com</a>, <a class="last reference external" href="mailto:dalwan01@student.umu.se">dalwan01@student.umu.se</a></td></tr>
|
||||
<td><a class="first reference external" href="mailto:dave@boost-consulting.com">dave@boost-consulting.com</a>, <a class="last reference external" href="mailto:daniel@boostpro.com">daniel@boostpro.com</a></td></tr>
|
||||
<tr><th class="docinfo-name">Organization:</th>
|
||||
<td><a class="first last reference external" href="http://www.boost-consulting.com">Boost Consulting</a></td></tr>
|
||||
<td><a class="first last reference external" href="http://www.boostpro.com">BoostPro Computing</a></td></tr>
|
||||
<tr><th class="docinfo-name">Date:</th>
|
||||
<td>2005-07-17</td></tr>
|
||||
<tr><th class="docinfo-name">Copyright:</th>
|
||||
<td>Copyright David Abrahams, Daniel Wallin
|
||||
2005. Distributed under the Boost Software License,
|
||||
2005-2009. Distributed under the Boost Software License,
|
||||
Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||
or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</td></tr>
|
||||
</tbody>
|
||||
@@ -53,31 +53,31 @@ or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#class-templates" id="id39">4 Class Templates</a><ul class="auto-toc">
|
||||
<li><a class="reference internal" href="#id7" id="id40">4.1 <tt class="docutils literal"><span class="pre">keyword</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#parameters" id="id41">4.2 <tt class="docutils literal"><span class="pre">parameters</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#optional-required" id="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>
|
||||
<li><a class="reference internal" href="#deduced" id="id43">4.4 <tt class="docutils literal"><span class="pre">deduced</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#id7" id="id40">4.1 <tt class="docutils literal">keyword</tt></a></li>
|
||||
<li><a class="reference internal" href="#parameters" id="id41">4.2 <tt class="docutils literal">parameters</tt></a></li>
|
||||
<li><a class="reference internal" href="#optional-required" id="id42">4.3 <tt class="docutils literal">optional</tt>, <tt class="docutils literal">required</tt></a></li>
|
||||
<li><a class="reference internal" href="#deduced" id="id43">4.4 <tt class="docutils literal">deduced</tt></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#metafunctions" id="id44">5 Metafunctions</a><ul class="auto-toc">
|
||||
<li><a class="reference internal" href="#binding" id="id45">5.1 <tt class="docutils literal"><span class="pre">binding</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#lazy-binding" id="id46">5.2 <tt class="docutils literal"><span class="pre">lazy_binding</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#value-type" id="id47">5.3 <tt class="docutils literal"><span class="pre">value_type</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#binding" id="id45">5.1 <tt class="docutils literal">binding</tt></a></li>
|
||||
<li><a class="reference internal" href="#lazy-binding" id="id46">5.2 <tt class="docutils literal">lazy_binding</tt></a></li>
|
||||
<li><a class="reference internal" href="#value-type" id="id47">5.3 <tt class="docutils literal">value_type</tt></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#code-generation-macros" id="id48">6 Code Generation Macros</a><ul class="auto-toc">
|
||||
<li><a class="reference internal" href="#boost-parameter-function-result-name-tag-namespace-arguments" id="id49">6.1 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-member-function-result-name-tag-namespace-arguments" id="id50">6.2 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MEMBER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-constructor-cls-impl-tag-namespace-arguments" id="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>
|
||||
<li><a class="reference internal" href="#boost-parameter-name-name" id="id52">6.4 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_NAME(name)</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-template-keyword-name" id="id53">6.5 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-fun-r-n-l-h-p" id="id54">6.6 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUN(r,n,l,h,p)</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-keyword-n-k" id="id55">6.7 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_KEYWORD(n,k)</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-match-p-a-x" id="id56">6.8 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MATCH(p,a,x)</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-function-result-name-tag-namespace-arguments" id="id49">6.1 <tt class="docutils literal">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-member-function-result-name-tag-namespace-arguments" id="id50">6.2 <tt class="docutils literal">BOOST_PARAMETER_MEMBER_FUNCTION(result,name,tag_namespace,arguments)</tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-constructor-cls-impl-tag-namespace-arguments" id="id51">6.3 <tt class="docutils literal">BOOST_PARAMETER_CONSTRUCTOR(cls, impl, tag_namespace, arguments)</tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-name-name" id="id52">6.4 <tt class="docutils literal">BOOST_PARAMETER_NAME(name)</tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-template-keyword-name" id="id53">6.5 <tt class="docutils literal">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-fun-r-n-l-h-p" id="id54">6.6 <tt class="docutils literal">BOOST_PARAMETER_FUN(r,n,l,h,p)</tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-keyword-n-k" id="id55">6.7 <tt class="docutils literal">BOOST_PARAMETER_KEYWORD(n,k)</tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-match-p-a-x" id="id56">6.8 <tt class="docutils literal">BOOST_PARAMETER_MATCH(p,a,x)</tt></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#configuration-macros" id="id57">7 Configuration Macros</a><ul class="auto-toc">
|
||||
<li><a class="reference internal" href="#boost-parameter-max-arity" id="id58">7.1 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MAX_ARITY</span></tt></a></li>
|
||||
<li><a class="reference internal" href="#boost-parameter-max-arity" id="id58">7.1 <tt class="docutils literal">BOOST_PARAMETER_MAX_ARITY</tt></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#tutorial" id="id59">8 Tutorial</a></li>
|
||||
@@ -113,7 +113,7 @@ follows the code block.</p>
|
||||
<p>In a specification of the tokens generated by a macro, <strong>bold
|
||||
type</strong> is used to highlight the position of the expanded macro
|
||||
argument in the result.</p>
|
||||
<p>The special character β represents the value of <a class="reference internal" href="#boost-parameter-max-arity"><tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MAX_ARITY</span></tt></a>.</p>
|
||||
<p>The special character β represents the value of <a class="reference internal" href="#boost-parameter-max-arity"><tt class="docutils literal">BOOST_PARAMETER_MAX_ARITY</tt></a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="docutils" />
|
||||
@@ -140,15 +140,15 @@ parameter list.</dd>
|
||||
</dl>
|
||||
<span class="target" id="keyword-object"></span><dl class="docutils">
|
||||
<dt>keyword object</dt>
|
||||
<dd>An instance of <a class="reference internal" 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 internal" href="#tag-type">tag type</a> <tt class="docutils literal"><span class="pre">T</span></tt>.</dd>
|
||||
<dd>An instance of <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a> <tt class="docutils literal"><T></tt> for some <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal">T</tt>.</dd>
|
||||
</dl>
|
||||
<span class="target" id="tagged-reference"></span><dl class="docutils">
|
||||
<dt>tagged reference</dt>
|
||||
<dd><p class="first">An object whose type is associated with a <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> (the
|
||||
object's <em>keyword</em>), and that holds a reference (to the object's
|
||||
<em>value</em>).</p>
|
||||
<p class="last">As a shorthand, a “tagged reference to <tt class="docutils literal"><span class="pre">x</span></tt>” means a tagged
|
||||
reference whose <em>value</em> is <tt class="docutils literal"><span class="pre">x</span></tt>.</p>
|
||||
<p class="last">As a shorthand, a “tagged reference to <tt class="docutils literal">x</tt>” means a tagged
|
||||
reference whose <em>value</em> is <tt class="docutils literal">x</tt>.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<span class="target" id="tagged-default"></span><dl class="docutils">
|
||||
@@ -165,7 +165,7 @@ arguments, computes a default argument value.</dd>
|
||||
<dt>intended argument type</dt>
|
||||
<dd>The <em>intended argument type</em> of a single-element <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> is the
|
||||
type of its element's <em>value</em>. The intended argument type of any other
|
||||
type <tt class="docutils literal"><span class="pre">X</span></tt> is <tt class="docutils literal"><span class="pre">X</span></tt> itself.</dd>
|
||||
type <tt class="docutils literal">X</tt> is <tt class="docutils literal">X</tt> itself.</dd>
|
||||
</dl>
|
||||
<div class="note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
@@ -188,14 +188,14 @@ also a valid MPL <a class="reference external" href="../../../mpl/doc/refmanual/
|
||||
<h3>Requirements</h3>
|
||||
<p>In the table below,</p>
|
||||
<ul class="simple">
|
||||
<li><tt class="docutils literal"><span class="pre">A</span></tt> is a model of <span class="concept">ArgumentPack</span></li>
|
||||
<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>
|
||||
<li><tt class="docutils literal"><span class="pre">u</span></tt> is a <a class="reference internal" href="#keyword-object">keyword object</a> of type <tt class="docutils literal"><span class="pre">K</span></tt></li>
|
||||
<li><tt class="docutils literal"><span class="pre">v</span></tt> is a <a class="reference internal" href="#tagged-default">tagged default</a> with <a class="reference internal" 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>
|
||||
<li><tt class="docutils literal"><span class="pre">w</span></tt> is a <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a> with <a class="reference internal" 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>
|
||||
<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 internal" href="#keyword"><tt class="docutils literal"><span class="pre">keyword</span></tt></a><tt class="docutils literal"><span class="pre"><…>::operator=</span></tt>)</li>
|
||||
<li><tt class="docutils literal">A</tt> is a model of <span class="concept">ArgumentPack</span></li>
|
||||
<li><tt class="docutils literal">x</tt> is an instance of <tt class="docutils literal">A</tt></li>
|
||||
<li><tt class="docutils literal">u</tt> is a <a class="reference internal" href="#keyword-object">keyword object</a> of type <tt class="docutils literal">K</tt></li>
|
||||
<li><tt class="docutils literal">v</tt> is a <a class="reference internal" href="#tagged-default">tagged default</a> with <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal">L</tt> and <em>value</em> of type <tt class="docutils literal">D</tt></li>
|
||||
<li><tt class="docutils literal">w</tt> is a <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a> with <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal">M</tt> and <em>value</em> of type <tt class="docutils literal">E const</tt></li>
|
||||
<li><tt class="docutils literal">z</tt> is an <span class="concept">ArgumentPack</span> containing a single element (as created by <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><tt class="docutils literal"><span class="pre"><…>::operator=</span></tt>)</li>
|
||||
</ul>
|
||||
<p>Any exceptions are thrown from the invocation of <tt class="docutils literal"><span class="pre">w</span></tt>'s <em>value</em>
|
||||
<p>Any exceptions are thrown from the invocation of <tt class="docutils literal">w</tt>'s <em>value</em>
|
||||
will be propagated to the caller.</p>
|
||||
<table border="1" class="docutils">
|
||||
<caption><span class="concept">ArgumentPack</span> requirements</caption>
|
||||
@@ -213,36 +213,36 @@ will be propagated to the caller.</p>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td><tt class="docutils literal"><span class="pre">x[u]</span></tt></td>
|
||||
<tr><td><tt class="docutils literal">x[u]</tt></td>
|
||||
<td><tt class="docutils literal"><span class="pre">binding<A,K>::type</span></tt></td>
|
||||
<td><tt class="docutils literal"><span class="pre">x</span></tt> contains an
|
||||
<td><tt class="docutils literal">x</tt> contains an
|
||||
element <em>b</em> whose
|
||||
<a class="reference internal" href="#kw">keyword</a> is <tt class="docutils literal"><span class="pre">K</span></tt></td>
|
||||
<a class="reference internal" href="#kw">keyword</a> is <tt class="docutils literal">K</tt></td>
|
||||
<td>Returns <em>b</em>'s <em>value</em> (by
|
||||
reference).</td>
|
||||
</tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">x[u]</span></tt></td>
|
||||
<tr><td><tt class="docutils literal">x[u]</tt></td>
|
||||
<td><tt class="docutils literal"><span class="pre">binding<A,L,D>::type</span></tt></td>
|
||||
<td><em>none</em></td>
|
||||
<td>If <tt class="docutils literal"><span class="pre">x</span></tt> contains an element <em>b</em> whose
|
||||
<a class="reference internal" href="#kw">keyword</a> is the same as <tt class="docutils literal"><span class="pre">u</span></tt>'s,
|
||||
<td>If <tt class="docutils literal">x</tt> contains an element <em>b</em> whose
|
||||
<a class="reference internal" href="#kw">keyword</a> is the same as <tt class="docutils literal">u</tt>'s,
|
||||
returns <em>b</em>'s <em>value</em> (by
|
||||
reference). Otherwise, returns <tt class="docutils literal"><span class="pre">u</span></tt>'s <em>value</em>.</td>
|
||||
reference). Otherwise, returns <tt class="docutils literal">u</tt>'s <em>value</em>.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">x[w]</span></tt></td>
|
||||
<tr><td><tt class="docutils literal">x[w]</tt></td>
|
||||
<td><tt class="docutils literal"><span class="pre">lazy_binding<A,M,E>::type</span></tt></td>
|
||||
<td><em>none</em></td>
|
||||
<td>If <tt class="docutils literal"><span class="pre">x</span></tt> contains an element <em>b</em> whose
|
||||
<a class="reference internal" href="#kw">keyword</a> is the same as <tt class="docutils literal"><span class="pre">w</span></tt>'s,
|
||||
<td>If <tt class="docutils literal">x</tt> contains an element <em>b</em> whose
|
||||
<a class="reference internal" href="#kw">keyword</a> is the same as <tt class="docutils literal">w</tt>'s,
|
||||
returns <em>b</em>'s <em>value</em> (by
|
||||
reference). Otherwise, invokes <tt class="docutils literal"><span class="pre">w</span></tt>'s <em>value</em> and returns the result.</td>
|
||||
reference). Otherwise, invokes <tt class="docutils literal">w</tt>'s <em>value</em> and returns the result.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">x,</span> <span class="pre">z</span></tt></td>
|
||||
<tr><td><tt class="docutils literal">x, z</tt></td>
|
||||
<td>Model of <span class="concept">ArgumentPack</span></td>
|
||||
<td><em>none</em></td>
|
||||
<td>Returns an <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing
|
||||
all the elements of both <tt class="docutils literal"><span class="pre">x</span></tt> and
|
||||
<tt class="docutils literal"><span class="pre">z</span></tt>.</td>
|
||||
all the elements of both <tt class="docutils literal">x</tt> and
|
||||
<tt class="docutils literal">z</tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -256,9 +256,9 @@ is optional or required. The table below details the allowed forms
|
||||
and describes their condition for satisfaction by an actual
|
||||
argument type. In each row,</p>
|
||||
<ul class="simple" id="conditions">
|
||||
<li><tt class="docutils literal"><span class="pre">K</span></tt> is the <span class="concept">ParameterSpec</span>'s <a class="reference internal" href="#keyword-tag-type">keyword tag type</a></li>
|
||||
<li><tt class="docutils literal"><span class="pre">A</span></tt> is an <a class="reference internal" href="#intended-argument-type">intended argument type</a> associated with <tt class="docutils literal"><span class="pre">K</span></tt>, if any</li>
|
||||
<li><tt class="docutils literal"><span class="pre">F</span></tt> is a unary <a class="reference external" href="../../../mpl/doc/refmanual/lambda-expression.html">MPL lambda expression</a></li>
|
||||
<li><tt class="docutils literal">K</tt> is the <span class="concept">ParameterSpec</span>'s <a class="reference internal" href="#keyword-tag-type">keyword tag type</a></li>
|
||||
<li><tt class="docutils literal">A</tt> is an <a class="reference internal" href="#intended-argument-type">intended argument type</a> associated with <tt class="docutils literal">K</tt>, if any</li>
|
||||
<li><tt class="docutils literal">F</tt> is a unary <a class="reference external" href="../../../mpl/doc/refmanual/lambda-expression.html">MPL lambda expression</a></li>
|
||||
</ul>
|
||||
<table border="1" class="docutils">
|
||||
<caption><span class="concept">ParameterSpec</span> allowed forms and conditions of satisfaction</caption>
|
||||
@@ -269,24 +269,24 @@ argument type. In each row,</p>
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th class="head">Type</th>
|
||||
<th class="head"><tt class="docutils literal"><span class="pre">A</span></tt> required</th>
|
||||
<th class="head">Condition <tt class="docutils literal"><span class="pre">A</span></tt> must satisfy</th>
|
||||
<th class="head"><tt class="docutils literal">A</tt> required</th>
|
||||
<th class="head">Condition <tt class="docutils literal">A</tt> must satisfy</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td><tt class="docutils literal"><span class="pre">K</span></tt></td>
|
||||
<tr><td><tt class="docutils literal">K</tt></td>
|
||||
<td>no</td>
|
||||
<td><em>n/a</em></td>
|
||||
</tr>
|
||||
<tr><td><a class="reference internal" 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>
|
||||
<tr><td><a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a><tt class="docutils literal"><K,F></tt></td>
|
||||
<td>no</td>
|
||||
<td><tt class="docutils literal"><span class="pre">mpl::apply<F,A>::type::value</span></tt>
|
||||
is <tt class="docutils literal"><span class="pre">true</span></tt>.</td>
|
||||
is <tt class="docutils literal">true</tt>.</td>
|
||||
</tr>
|
||||
<tr><td><a class="reference internal" 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>
|
||||
<tr><td><a class="reference internal" href="#required"><tt class="docutils literal">required</tt></a><tt class="docutils literal"><K,F></tt></td>
|
||||
<td>yes</td>
|
||||
<td><tt class="docutils literal"><span class="pre">mpl::apply<F,A>::type::value</span></tt>
|
||||
is <tt class="docutils literal"><span class="pre">true</span></tt>.</td>
|
||||
is <tt class="docutils literal">true</tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -298,8 +298,8 @@ arguments that will be matched by <a class="reference external" href="index.html
|
||||
<div class="section" id="class-templates">
|
||||
<h1><a class="toc-backref" href="#id39">4 Class Templates</a></h1>
|
||||
<div class="section" id="id7">
|
||||
<span id="keyword"></span><h2><a class="toc-backref" href="#id40">4.1 <tt class="docutils literal"><span class="pre">keyword</span></tt></a></h2>
|
||||
<p>The type of every <a class="reference internal" href="#keyword-object">keyword object</a> is a specialization of <tt class="docutils literal"><span class="pre">keyword</span></tt>.</p>
|
||||
<span id="keyword"></span><h2><a class="toc-backref" href="#id40">4.1 <tt class="docutils literal">keyword</tt></a></h2>
|
||||
<p>The type of every <a class="reference internal" href="#keyword-object">keyword object</a> is a specialization of <tt class="docutils literal">keyword</tt>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@@ -324,7 +324,7 @@ struct keyword
|
||||
};
|
||||
</pre>
|
||||
<dl class="docutils" id="operator">
|
||||
<dt><tt class="docutils literal"><span class="pre">operator=</span></tt></dt>
|
||||
<dt><tt class="docutils literal">operator=</tt></dt>
|
||||
<dd><pre class="first literal-block">
|
||||
template <class T> <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T& value) const;
|
||||
template <class T> <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T const& value) const;
|
||||
@@ -336,14 +336,14 @@ template <class T> <a class="reference internal" href="#argumentpack"><spa
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body">nothing</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">an <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing a single <a class="reference internal" href="#tagged-reference">tagged reference</a> to
|
||||
<tt class="docutils literal"><span class="pre">value</span></tt> with <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal"><span class="pre">Tag</span></tt></td>
|
||||
<tt class="docutils literal">value</tt> with <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">Tag</tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="docutils" id="id9">
|
||||
<dt><tt class="docutils literal"><span class="pre">operator|</span></tt></dt>
|
||||
<dt><tt class="docutils literal">operator|</tt></dt>
|
||||
<dd><pre class="first literal-block">
|
||||
template <class T> <em>tagged default</em> operator|(T& x) const;
|
||||
template <class T> <em>tagged default</em> operator|(T const& x) const;
|
||||
@@ -352,14 +352,14 @@ template <class T> <em>tagged default</em> operator|(T const& x) const
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference internal" href="#tagged-default">tagged default</a> with <em>value</em> <tt class="docutils literal"><span class="pre">x</span></tt> and <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal"><span class="pre">Tag</span></tt>.</td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference internal" href="#tagged-default">tagged default</a> with <em>value</em> <tt class="docutils literal">x</tt> and <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">Tag</tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="docutils" id="id10">
|
||||
<dt><tt class="docutils literal"><span class="pre">operator||</span></tt></dt>
|
||||
<dt><tt class="docutils literal">operator||</tt></dt>
|
||||
<dd><pre class="first literal-block">
|
||||
template <class F> <em>tagged lazy default</em> operator||(F const& g) const;
|
||||
</pre>
|
||||
@@ -367,16 +367,16 @@ template <class F> <em>tagged lazy default</em> operator||(F const& g)
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<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 external" 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"><sup>2</sup></a></td>
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">g()</tt> is valid, with type <tt class="docutils literal">boost::</tt><a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal">result_of</tt></a><tt class="docutils literal"><span class="pre"><F()>::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id11"><sup>2</sup></a></td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference internal" 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 internal" href="#kw">keyword</a> <tt class="docutils literal"><span class="pre">Tag</span></tt>.</td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a> with <em>value</em> <tt class="docutils literal">g</tt> and <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">Tag</tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="docutils" id="get">
|
||||
<dt><tt class="docutils literal"><span class="pre">get</span></tt></dt>
|
||||
<dt><tt class="docutils literal">get</tt></dt>
|
||||
<dd><pre class="first literal-block">
|
||||
static keyword<Tag>& get();
|
||||
</pre>
|
||||
@@ -385,9 +385,9 @@ static keyword<Tag>& get();
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a “singleton instance”: the same object will be
|
||||
returned on each invocation of <tt class="docutils literal"><span class="pre">get()</span></tt>.</td>
|
||||
returned on each invocation of <tt class="docutils literal">get()</tt>.</td>
|
||||
</tr>
|
||||
<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
|
||||
<tr class="field"><th class="field-name">Thread Safety:</th><td class="field-body"><tt class="docutils literal">get()</tt> can be called from multiple threads
|
||||
simultaneously.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -396,11 +396,11 @@ simultaneously.</td>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="parameters">
|
||||
<h2><a class="toc-backref" href="#id41">4.2 <tt class="docutils literal"><span class="pre">parameters</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id41">4.2 <tt class="docutils literal">parameters</tt></a></h2>
|
||||
<p>Provides an interface for assembling the actual arguments to a
|
||||
<cite>forwarding function</cite> into an <span class="concept">ArgumentPack</span>, in which any
|
||||
<a class="reference internal" href="#positional">positional</a> arguments will be tagged according to the
|
||||
corresponding template argument to <tt class="docutils literal"><span class="pre">parameters</span></tt>.</p>
|
||||
corresponding template argument to <tt class="docutils literal">parameters</tt>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@@ -435,78 +435,78 @@ struct parameters
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<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 internal" href="#parameterspec"><span class="concept">ParameterSpec</span></a>.</td>
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">P0</tt>, <tt class="docutils literal">P1</tt>, … <tt class="docutils literal">P</tt>β are models of <a class="reference internal" href="#parameterspec"><span class="concept">ParameterSpec</span></a>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<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
|
||||
follows, for any argument type <tt class="docutils literal"><span class="pre">A</span></tt><em>i</em>:</p>
|
||||
<p>In this section, <tt class="docutils literal">R</tt><em>i</em> and <tt class="docutils literal">K</tt><em>i</em> are defined as
|
||||
follows, for any argument type <tt class="docutils literal">A</tt><em>i</em>:</p>
|
||||
<blockquote class="last">
|
||||
<div class="line-block">
|
||||
<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>
|
||||
<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 internal" href="#intended-argument-type">intended argument type</a></div>
|
||||
<div class="line">let <tt class="docutils literal">D0</tt> the set [d0, …, d<em>j</em>] of all <strong>deduced</strong> <em>parameter specs</em> in [<tt class="docutils literal">P0</tt>, …, <tt class="docutils literal">P</tt>β]</div>
|
||||
<div class="line"><tt class="docutils literal">R</tt><em>i</em> is <tt class="docutils literal">A</tt><em>i</em>'s <a class="reference internal" href="#intended-argument-type">intended argument type</a></div>
|
||||
<div class="line"><br /></div>
|
||||
<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 internal" href="#operator"><tt class="docutils literal"><span class="pre">operator=</span></tt></a></div>
|
||||
<div class="line">if <tt class="docutils literal">A</tt><em>i</em> is a result type of <tt class="docutils literal"><span class="pre">keyword<T>::</span></tt><a class="reference internal" href="#operator"><tt class="docutils literal">operator=</tt></a></div>
|
||||
<div class="line">then</div>
|
||||
<div class="line-block">
|
||||
<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>
|
||||
<div class="line"><tt class="docutils literal">K</tt><em>i</em> is <tt class="docutils literal">T</tt></div>
|
||||
</div>
|
||||
<div class="line">else</div>
|
||||
<div class="line-block">
|
||||
<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 internal" href="#operator"><tt class="docutils literal"><span class="pre">operator=</span></tt></a></div>
|
||||
<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>
|
||||
<div class="line">if some <tt class="docutils literal">A</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 internal" href="#operator"><tt class="docutils literal">operator=</tt></a></div>
|
||||
<div class="line"><em>or</em> some <tt class="docutils literal">P</tt><em>j</em> in <em>j</em>≤<em>i</em> is <strong>deduced</strong></div>
|
||||
<div class="line">then</div>
|
||||
<div class="line-block">
|
||||
<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>
|
||||
<div class="line">if some <em>parameter spec</em> <tt class="docutils literal">d</tt><em>j</em> in <tt class="docutils literal">D</tt><em>i</em> matches <tt class="docutils literal">A</tt><em>i</em></div>
|
||||
<div class="line">then</div>
|
||||
<div class="line-block">
|
||||
<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 internal" href="#keyword-tag-type">keyword tag type</a>.</div>
|
||||
<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>
|
||||
<div class="line"><tt class="docutils literal">K</tt><em>i</em> is <tt class="docutils literal">d</tt><em>j</em>'s <a class="reference internal" href="#keyword-tag-type">keyword tag type</a>.</div>
|
||||
<div class="line"><tt class="docutils literal">D</tt><sub>i+1</sub> is <tt class="docutils literal">D</tt><em>i</em> - [<tt class="docutils literal">d</tt><em>j</em>]</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line">else</div>
|
||||
<div class="line-block">
|
||||
<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 internal" href="#keyword-tag-type">keyword tag type</a>.</div>
|
||||
<div class="line"><tt class="docutils literal">K</tt><em>i</em> is <tt class="docutils literal">P</tt><em>i</em>'s <a class="reference internal" href="#keyword-tag-type">keyword tag type</a>.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blockquote>
|
||||
</div>
|
||||
<dl class="docutils" id="match">
|
||||
<dt><tt class="docutils literal"><span class="pre">match</span></tt></dt>
|
||||
<dt><tt class="docutils literal">match</tt></dt>
|
||||
<dd><p class="first">A <a class="reference external" href="../../../mpl/doc/refmanual/metafunction.html"><span class="concept">Metafunction</span></a> used to remove a <a class="reference external" href="index.html#forwarding-functions">forwarding function</a> from overload resolution.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<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
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">if <tt class="docutils literal">P0</tt>, <tt class="docutils literal">P1</tt>, …<tt class="docutils literal">P</tt>β are <em>satisfied</em> (see
|
||||
below), then <tt class="docutils literal"><span class="pre">parameters<P0,P1,…Pβ></span></tt>. Otherwise,
|
||||
<tt class="docutils literal"><span class="pre">match<A0,A1,…Aβ>::type</span></tt> is not defined.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<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
|
||||
<p><tt class="docutils literal">P0</tt>, <tt class="docutils literal">P1</tt>, …<tt class="docutils literal">P</tt>β are <strong>satisfied</strong> if, for
|
||||
every <em>j</em> in 0…β, either:</p>
|
||||
<ul class="last simple">
|
||||
<li><tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is the <em>unspecified</em> default</li>
|
||||
<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>
|
||||
<li><strong>or</strong>, <tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is <a class="reference internal" 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>
|
||||
<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>
|
||||
<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>
|
||||
<li><tt class="docutils literal">P</tt><em>j</em> is the <em>unspecified</em> default</li>
|
||||
<li><strong>or</strong>, <tt class="docutils literal">P</tt><em>j</em> is a <em>keyword tag type</em></li>
|
||||
<li><strong>or</strong>, <tt class="docutils literal">P</tt><em>j</em> is <a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a> <tt class="docutils literal"><X,F></tt> and either<ul>
|
||||
<li><tt class="docutils literal">X</tt> is not <tt class="docutils literal">K</tt><em>i</em> for any <em>i</em>,</li>
|
||||
<li><strong>or</strong> <tt class="docutils literal">X</tt> is some <tt class="docutils literal">K</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">true</tt></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>or</strong>, <tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is <a class="reference internal" 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>
|
||||
<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>
|
||||
<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>
|
||||
<li><strong>or</strong>, <tt class="docutils literal">P</tt><em>j</em> is <a class="reference internal" href="#required"><tt class="docutils literal">required</tt></a> <tt class="docutils literal"><X,F></tt>, and<ul>
|
||||
<li><tt class="docutils literal">X</tt> is some <tt class="docutils literal">K</tt><em>i</em>, <strong>and</strong></li>
|
||||
<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">true</tt></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="docutils" id="id13">
|
||||
<dt><tt class="docutils literal"><span class="pre">operator()</span></tt></dt>
|
||||
<dt><tt class="docutils literal">operator()</tt></dt>
|
||||
<dd><pre class="first literal-block">
|
||||
template <class A0> <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator()(A0 const& a0) const;
|
||||
|
||||
@@ -518,10 +518,10 @@ template <class A0, …class Aβ> <a class="reference internal" href="#arg
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An <a class="reference internal" 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>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing, for each <tt class="docutils literal">a</tt><em>i</em>,</p>
|
||||
<ul class="last simple">
|
||||
<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>
|
||||
<li>Otherwise, a <a class="reference internal" href="#tagged-reference">tagged reference</a> with <a class="reference internal" 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>
|
||||
<li>if <tt class="docutils literal">a</tt><em>i</em>, is a single-element <span class="concept">ArgumentPack</span>, its element</li>
|
||||
<li>Otherwise, a <a class="reference internal" href="#tagged-reference">tagged reference</a> with <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">K</tt><em>i</em> and <em>value</em> <tt class="docutils literal">a</tt><em>i</em></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -531,7 +531,7 @@ template <class A0, …class Aβ> <a class="reference internal" href="#arg
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="optional-required">
|
||||
<span id="required"></span><span id="optional"></span><h2><a class="toc-backref" href="#id42">4.3 <tt class="docutils literal"><span class="pre">optional</span></tt>, <tt class="docutils literal"><span class="pre">required</span></tt></a></h2>
|
||||
<span id="required"></span><span id="optional"></span><h2><a class="toc-backref" href="#id42">4.3 <tt class="docutils literal">optional</tt>, <tt class="docutils literal">required</tt></a></h2>
|
||||
<p>These templates describe the requirements on a function parameter.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@@ -557,13 +557,13 @@ struct optional;
|
||||
template <class Tag, class Predicate = <em>unspecified</em>>
|
||||
struct required;
|
||||
</pre>
|
||||
<p>The default value of <tt class="docutils literal"><span class="pre">Predicate</span></tt> is an unspecified <a class="reference external" href="../../../mpl/doc/refmanual/metafunction.html"><span class="concept">Metafunction</span></a> that returns
|
||||
<p>The default value of <tt class="docutils literal">Predicate</tt> is an unspecified <a class="reference external" href="../../../mpl/doc/refmanual/metafunction.html"><span class="concept">Metafunction</span></a> that returns
|
||||
<tt class="docutils literal"><span class="pre">mpl::true_</span></tt> for any argument.</p>
|
||||
</div>
|
||||
<div class="section" id="deduced">
|
||||
<h2><a class="toc-backref" href="#id43">4.4 <tt class="docutils literal"><span class="pre">deduced</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id43">4.4 <tt class="docutils literal">deduced</tt></a></h2>
|
||||
<p>This template is used to wrap the <em>keyword tag</em> argument to
|
||||
<tt class="docutils literal"><span class="pre">optional</span></tt> or <tt class="docutils literal"><span class="pre">required</span></tt>.</p>
|
||||
<tt class="docutils literal">optional</tt> or <tt class="docutils literal">required</tt>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@@ -584,7 +584,7 @@ struct deduced;
|
||||
<p>A <a class="reference external" href="../../../mpl/doc/refmanual/metafunction.html"><span class="concept">Metafunction</span></a> is conceptually a function that operates on, and
|
||||
returns, C++ types.</p>
|
||||
<div class="section" id="binding">
|
||||
<h2><a class="toc-backref" href="#id45">5.1 <tt class="docutils literal"><span class="pre">binding</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id45">5.1 <tt class="docutils literal">binding</tt></a></h2>
|
||||
<p>Returns the result type of indexing an argument pack with a
|
||||
<a class="reference internal" href="#keyword-tag-type">keyword tag type</a> or with a <a class="reference internal" href="#tagged-default">tagged default</a>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
@@ -606,16 +606,16 @@ struct binding
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<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 internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td>
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">A</tt> is a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the reference type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal"><span class="pre">A</span></tt>
|
||||
having <a class="reference internal" 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 internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal"><span class="pre">D</span></tt>.</td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the reference type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal">A</tt>
|
||||
having <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal">K</tt>, if any. If no such <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal">D</tt>.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="lazy-binding">
|
||||
<h2><a class="toc-backref" href="#id46">5.2 <tt class="docutils literal"><span class="pre">lazy_binding</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id46">5.2 <tt class="docutils literal">lazy_binding</tt></a></h2>
|
||||
<p>Returns the result type of indexing an argument pack with a <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@@ -636,16 +636,16 @@ struct lazy_binding
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<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 internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td>
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">A</tt> is a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the reference type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal"><span class="pre">A</span></tt>
|
||||
having <a class="reference internal" 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 internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal"><span class="pre">boost::</span></tt><a class="reference external" 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"><sup>2</sup></a></td>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the reference type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal">A</tt>
|
||||
having <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal">K</tt>, if any. If no such <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal">boost::</tt><a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal">result_of</tt></a><tt class="docutils literal"><span class="pre"><F()>::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id18"><sup>2</sup></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="value-type">
|
||||
<h2><a class="toc-backref" href="#id47">5.3 <tt class="docutils literal"><span class="pre">value_type</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id47">5.3 <tt class="docutils literal">value_type</tt></a></h2>
|
||||
<p>Returns the result type of indexing an argument pack with a
|
||||
<a class="reference internal" href="#keyword-tag-type">keyword tag type</a> or with a <a class="reference internal" href="#tagged-default">tagged default</a>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
@@ -667,17 +667,17 @@ struct value_type
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<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 internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</p>
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal">A</tt> is a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal"><span class="pre">A</span></tt>
|
||||
having <a class="reference internal" 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 internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal"><span class="pre">D</span></tt>. Equivalent to:</p>
|
||||
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal">A</tt>
|
||||
having <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal">K</tt>, if any. If no such <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal">D</tt>. Equivalent to:</p>
|
||||
<pre class="literal-block">
|
||||
typename remove_reference<
|
||||
typename binding<A, K, D>::type
|
||||
>::type
|
||||
</pre>
|
||||
<p class="last">… when <tt class="docutils literal"><span class="pre">D</span></tt> is not a reference type.</p>
|
||||
<p class="last">… when <tt class="docutils literal">D</tt> is not a reference type.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -690,7 +690,7 @@ typename remove_reference<
|
||||
<p>Macros in this section can be used to ease the writing of code
|
||||
using the Parameter libray by eliminating repetitive boilerplate.</p>
|
||||
<div class="section" id="boost-parameter-function-result-name-tag-namespace-arguments">
|
||||
<h2><a class="toc-backref" href="#id49">6.1 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id49">6.1 <tt class="docutils literal">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</tt></a></h2>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@@ -703,10 +703,10 @@ using the Parameter libray by eliminating repetitive boilerplate.</p>
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<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.
|
||||
<tt class="docutils literal"><span class="pre">name</span></tt> is the base name of the function, this is the name of the
|
||||
generated forwarding functions. <tt class="docutils literal"><span class="pre">tag_namespace</span></tt> is the namespace in
|
||||
which the keywords used by the function resides. <tt class="docutils literal"><span class="pre">arguments</span></tt> is
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal">result</tt> is the parenthesized return type of the function.
|
||||
<tt class="docutils literal">name</tt> is the base name of the function, this is the name of the
|
||||
generated forwarding functions. <tt class="docutils literal">tag_namespace</tt> is the namespace in
|
||||
which the keywords used by the function resides. <tt class="docutils literal">arguments</tt> is
|
||||
a list of <em>argument specifiers</em>, as defined below.</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -727,8 +727,8 @@ restriction ::= ('<strong>*</strong>' '<strong>(</strong>' <em>lambda-expression
|
||||
( '<strong>(</strong>' <em>typename</em> '<strong>)</strong>' ) |
|
||||
'<strong>*</strong>'
|
||||
</pre>
|
||||
<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
|
||||
C++ expression. <tt class="docutils literal"><span class="pre">typename</span></tt> is the name of a type.
|
||||
<p class="last"><tt class="docutils literal">name</tt> is any valid C++ identifier. <tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid
|
||||
C++ expression. <tt class="docutils literal">typename</tt> is the name of a type.
|
||||
<tt class="docutils literal"><span class="pre">lambda-expression</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/lambda-expression.html">MPL lambda expression</a>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -740,11 +740,11 @@ C++ expression. <tt class="docutils literal"><span class="pre">typename</span></
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name" colspan="2">Generated names in enclosing scope:</th></tr>
|
||||
<tr><td> </td><td class="field-body"><ul class="first last simple">
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<li><tt class="docutils literal"><span class="pre">boost_param_impl</span> <span class="pre">##</span> <span class="pre">name</span></tt></li>
|
||||
<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>
|
||||
<li><tt class="docutils literal">boost_param_result_ ## __LINE__ ## name</tt></li>
|
||||
<li><tt class="docutils literal">boost_param_params_ ## __LINE__ ## name</tt></li>
|
||||
<li><tt class="docutils literal">boost_param_parameters_ ## __LINE__ ## name</tt></li>
|
||||
<li><tt class="docutils literal">boost_param_impl ## name</tt></li>
|
||||
<li><tt class="docutils literal">boost_param_default_ ## __LINE__ ## name</tt></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -754,8 +754,8 @@ C++ expression. <tt class="docutils literal"><span class="pre">typename</span></
|
||||
<dt>Approximate expansion:</dt>
|
||||
<dd><p class="first"><strong>Where</strong>:</p>
|
||||
<ul class="simple">
|
||||
<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>
|
||||
<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>
|
||||
<li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
|
||||
<li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
|
||||
</ul>
|
||||
<pre class="last literal-block">
|
||||
template <class T>
|
||||
@@ -814,7 +814,7 @@ ResultType boost_param_default_ ## __LINE__ ## <strong>name</strong>(
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="boost-parameter-member-function-result-name-tag-namespace-arguments">
|
||||
<h2><a class="toc-backref" href="#id50">6.2 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MEMBER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id50">6.2 <tt class="docutils literal">BOOST_PARAMETER_MEMBER_FUNCTION(result,name,tag_namespace,arguments)</tt></a></h2>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@@ -823,10 +823,10 @@ ResultType boost_param_default_ ## __LINE__ ## <strong>name</strong>(
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>See <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></p>
|
||||
<p>See <tt class="docutils literal">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</tt></p>
|
||||
</div>
|
||||
<div class="section" id="boost-parameter-constructor-cls-impl-tag-namespace-arguments">
|
||||
<h2><a class="toc-backref" href="#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></h2>
|
||||
<h2><a class="toc-backref" href="#id51">6.3 <tt class="docutils literal">BOOST_PARAMETER_CONSTRUCTOR(cls, impl, tag_namespace, arguments)</tt></a></h2>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@@ -839,18 +839,18 @@ ResultType boost_param_default_ ## __LINE__ ## <strong>name</strong>(
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<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
|
||||
parenthesized implementation base class for <tt class="docutils literal"><span class="pre">cls</span></tt>.
|
||||
<tt class="docutils literal"><span class="pre">tag_namespace</span></tt> is the namespace in which the keywords
|
||||
used by the function resides. <tt class="docutils literal"><span class="pre">arguments</span></tt> is
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal">cls</tt> is the name of this class. <tt class="docutils literal">impl</tt> is the
|
||||
parenthesized implementation base class for <tt class="docutils literal">cls</tt>.
|
||||
<tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords
|
||||
used by the function resides. <tt class="docutils literal">arguments</tt> is
|
||||
a list of <em>argument specifiers</em>, as defined in
|
||||
<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</span></tt>.</p>
|
||||
<tt class="docutils literal">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</tt>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name" colspan="2">Generated names in enclosing scope:</th></tr>
|
||||
<tr><td> </td><td class="field-body"><ul class="first last simple">
|
||||
<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>
|
||||
<li><tt class="docutils literal"><span class="pre">constructor_parameters</span> <span class="pre">##</span> <span class="pre">__LINE__</span></tt></li>
|
||||
<li><tt class="docutils literal">boost_param_params_ ## __LINE__ ## ctor</tt></li>
|
||||
<li><tt class="docutils literal">constructor_parameters ## __LINE__</tt></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -860,8 +860,8 @@ a list of <em>argument specifiers</em>, as defined in
|
||||
<dt>Approximate expansion:</dt>
|
||||
<dd><p class="first"><strong>Where</strong>:</p>
|
||||
<ul class="simple">
|
||||
<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>
|
||||
<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>
|
||||
<li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
|
||||
<li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
|
||||
</ul>
|
||||
<pre class="last literal-block">
|
||||
struct boost_param_params_ ## __LINE__ ## ctor
|
||||
@@ -889,7 +889,7 @@ template <class A0, …, class A<strong>m</strong>>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="boost-parameter-name-name">
|
||||
<h2><a class="toc-backref" href="#id52">6.4 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_NAME(name)</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id52">6.4 <tt class="docutils literal">BOOST_PARAMETER_NAME(name)</tt></a></h2>
|
||||
<p>Declares a tag-type and keyword object.</p>
|
||||
<p>Expands to:</p>
|
||||
<p><strong>If</strong> <em>name</em> is of the form:</p>
|
||||
@@ -907,8 +907,8 @@ namespace <em>namespace-name</em>
|
||||
return ##<em>tag-name</em>;
|
||||
}
|
||||
|
||||
typedef <em>implementation defined</em> _;
|
||||
typedef <em>implementation defined</em> _1;
|
||||
typedef <em>unspecified</em> _;
|
||||
typedef <em>unspecified</em> _1;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -926,8 +926,8 @@ namespace tag
|
||||
return ##<em>name</em>;
|
||||
}
|
||||
|
||||
typedef <em>implementation defined</em> _;
|
||||
typedef <em>implementation defined</em> _1;
|
||||
typedef <em>unspecified</em> _;
|
||||
typedef <em>unspecified</em> _1;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -936,7 +936,7 @@ namespace tag
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="boost-parameter-template-keyword-name">
|
||||
<h2><a class="toc-backref" href="#id53">6.5 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id53">6.5 <tt class="docutils literal">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</tt></a></h2>
|
||||
<p>Expands to:</p>
|
||||
<pre class="literal-block">
|
||||
namespace tag
|
||||
@@ -951,15 +951,15 @@ struct <em>name</em>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="boost-parameter-fun-r-n-l-h-p">
|
||||
<h2><a class="toc-backref" href="#id54">6.6 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUN(r,n,l,h,p)</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id54">6.6 <tt class="docutils literal">BOOST_PARAMETER_FUN(r,n,l,h,p)</tt></a></h2>
|
||||
<div class="admonition-deprecated admonition">
|
||||
<p class="first admonition-title">Deprecated</p>
|
||||
<p class="last">This macro has been deprecated in favor of
|
||||
<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION</span></tt>.</p>
|
||||
<tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt>.</p>
|
||||
</div>
|
||||
<p>Generates a sequence of <a class="reference external" href="index.html#forwarding-functions">forwarding function</a> templates named
|
||||
<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>,
|
||||
and using <tt class="docutils literal"><span class="pre">p</span></tt> to control overload resolution and assign tags to
|
||||
<tt class="docutils literal">n</tt>, with arities ranging from <tt class="docutils literal">l</tt> to <tt class="docutils literal">h</tt> , returning <tt class="docutils literal">r</tt>,
|
||||
and using <tt class="docutils literal">p</tt> to control overload resolution and assign tags to
|
||||
positional arguments.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@@ -973,8 +973,8 @@ positional arguments.</p>
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<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
|
||||
that <tt class="docutils literal"><span class="pre">l</span></tt> < <tt class="docutils literal"><span class="pre">h</span></tt></td>
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">l</tt> and <tt class="docutils literal">h</tt> are nonnegative integer tokens such
|
||||
that <tt class="docutils literal">l</tt> < <tt class="docutils literal">h</tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -1012,14 +1012,14 @@ r name(
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="boost-parameter-keyword-n-k">
|
||||
<h2><a class="toc-backref" href="#id55">6.7 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_KEYWORD(n,k)</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id55">6.7 <tt class="docutils literal">BOOST_PARAMETER_KEYWORD(n,k)</tt></a></h2>
|
||||
<div class="admonition-deprecated admonition">
|
||||
<p class="first admonition-title">Deprecated</p>
|
||||
<p class="last">This macro has been deprecated in favor of
|
||||
<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_NAME</span></tt>.</p>
|
||||
<tt class="docutils literal">BOOST_PARAMETER_NAME</tt>.</p>
|
||||
</div>
|
||||
<p>Generates the declaration of a <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> named <tt class="docutils literal"><span class="pre">k</span></tt> in
|
||||
namespace <tt class="docutils literal"><span class="pre">n</span></tt>, and a corresponding <a class="reference internal" href="#keyword-object">keyword object</a> definition in
|
||||
<p>Generates the declaration of a <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> named <tt class="docutils literal">k</tt> in
|
||||
namespace <tt class="docutils literal">n</tt>, and a corresponding <a class="reference internal" href="#keyword-object">keyword object</a> definition in
|
||||
the enclosing namespace.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@@ -1042,7 +1042,7 @@ namespace {
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="boost-parameter-match-p-a-x">
|
||||
<h2><a class="toc-backref" href="#id56">6.8 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MATCH(p,a,x)</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id56">6.8 <tt class="docutils literal">BOOST_PARAMETER_MATCH(p,a,x)</tt></a></h2>
|
||||
<p>Generates a defaulted parameter declaration for a <a class="reference external" href="index.html#forwarding-functions">forwarding
|
||||
function</a>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
@@ -1057,7 +1057,7 @@ function</a>.</p>
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<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 external" href="http://www.boost.org/libs/preprocessor/doc/data.html">Boost.Preprocessor sequence</a>
|
||||
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal">a</tt> is a <a class="reference external" href="http://www.boost.org/libs/preprocessor/doc/data.html">Boost.Preprocessor sequence</a>
|
||||
of the form</p>
|
||||
<pre class="last literal-block">
|
||||
(A0)(A1)…(A<em>n</em>)
|
||||
@@ -1078,10 +1078,10 @@ typename <strong>p</strong>::match<<strong>A0</strong>,<strong>A1</strong>…
|
||||
<div class="section" id="configuration-macros">
|
||||
<h1><a class="toc-backref" href="#id57">7 Configuration Macros</a></h1>
|
||||
<div class="section" id="boost-parameter-max-arity">
|
||||
<h2><a class="toc-backref" href="#id58">7.1 <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MAX_ARITY</span></tt></a></h2>
|
||||
<h2><a class="toc-backref" href="#id58">7.1 <tt class="docutils literal">BOOST_PARAMETER_MAX_ARITY</tt></a></h2>
|
||||
<p>Determines the maximum number of arguments supported by the
|
||||
library. Will only be <tt class="docutils literal"><span class="pre">#defined</span></tt> by the library if it is not
|
||||
already <tt class="docutils literal"><span class="pre">#defined</span></tt>.</p>
|
||||
library. Will only be <tt class="docutils literal">#defined</tt> by the library if it is not
|
||||
already <tt class="docutils literal">#defined</tt>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
@@ -1094,7 +1094,7 @@ already <tt class="docutils literal"><span class="pre">#defined</span></tt>.</p>
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<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>
|
||||
<tr class="field"><th class="field-name">Default Value:</th><td class="field-body"><tt class="docutils literal">8</tt></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -1119,8 +1119,8 @@ where it could make a difference.</td></tr>
|
||||
<table class="docutils footnote" frame="void" id="no-result-of" rules="none">
|
||||
<colgroup><col class="label" /><col /></colgroup>
|
||||
<tbody valign="top">
|
||||
<tr><td class="label">[2]</td><td><em>(<a class="fn-backref" href="#id11">1</a>, <a class="fn-backref" href="#id18">2</a>)</em> Where <a class="reference external" 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>,
|
||||
<tt class="docutils literal"><span class="pre">boost::</span></tt><a class="reference external" 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
|
||||
<tr><td class="label">[2]</td><td><em>(<a class="fn-backref" href="#id11">1</a>, <a class="fn-backref" href="#id18">2</a>)</em> Where <a class="reference external" href="../../../utility/utility.htm#BOOST_NO_RESULT_OF"><tt class="docutils literal">BOOST_NO_RESULT_OF</tt></a> is <tt class="docutils literal">#defined</tt>,
|
||||
<tt class="docutils literal">boost::</tt><a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal">result_of</tt></a><tt class="docutils literal"><span class="pre"><F()>::type</span></tt> is replaced by
|
||||
<tt class="docutils literal"><span class="pre">F::result_type</span></tt>.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -1128,7 +1128,7 @@ where it could make a difference.</td></tr>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr class="footer" />
|
||||
Generated on: 2008-06-26 21:51 UTC.
|
||||
Generated on: 2011-11-08 21:40 UTC.
|
||||
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
|
||||
</div>
|
||||
|
||||
249
doc/index.rst
249
doc/index.rst
@@ -71,16 +71,16 @@ __ ../../../../index.htm
|
||||
-------------------------------------
|
||||
|
||||
:Authors: David Abrahams, Daniel Wallin
|
||||
:Contact: dave@boost-consulting.com, dalwan01@student.umu.se
|
||||
:Organization: `Boost Consulting`_
|
||||
:Date: $Date: 2005/07/18 20:34:31 $
|
||||
:Contact: dave@boost-consulting.com, daniel@boostpro.com
|
||||
:organization: `BoostPro Computing`_
|
||||
:date: $Date: 2005/07/17 19:53:01 $
|
||||
|
||||
:Copyright: Copyright David Abrahams, Daniel Wallin 2005.
|
||||
Distributed under the Boost Software License,
|
||||
:copyright: Copyright David Abrahams, Daniel Wallin
|
||||
2005-2009. 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)
|
||||
|
||||
.. _`Boost Consulting`: http://www.boost-consulting.com
|
||||
.. _`BoostPro Computing`: http://www.boostpro.com
|
||||
|
||||
.. _concepts: http://www.boost.org/more/generic_programming.html#concept
|
||||
|
||||
@@ -856,6 +856,44 @@ in parentheses *and preceded by an asterix*, as follows:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
// We first need to define a few metafunction that we use in the
|
||||
// predicates below.
|
||||
|
||||
template <class G>
|
||||
struct traversal_category
|
||||
{
|
||||
typedef typename boost::graph_traits<G>::traversal_category type;
|
||||
};
|
||||
|
||||
template <class G>
|
||||
struct vertex_descriptor
|
||||
{
|
||||
typedef typename boost::graph_traits<G>::vertex_descriptor type;
|
||||
};
|
||||
|
||||
template <class G>
|
||||
struct value_type
|
||||
{
|
||||
typedef typename boost::property_traits<G>::value_type type;
|
||||
};
|
||||
|
||||
template <class G>
|
||||
struct key_type
|
||||
{
|
||||
typedef typename boost::property_traits<G>::key_type type;
|
||||
};
|
||||
|
||||
template<class Size, class IndexMap>
|
||||
boost::iterator_property_map<
|
||||
boost::default_color_type\*, IndexMap
|
||||
, boost::default_color_type, boost::default_color_type&
|
||||
>
|
||||
default_color_map(Size num_vertices, IndexMap const& index_map)
|
||||
{
|
||||
std::vector<boost::default_color_type> colors(num_vertices);
|
||||
return &colors[0];
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(void), depth_first_search, graphs
|
||||
|
||||
@@ -863,12 +901,10 @@ in parentheses *and preceded by an asterix*, as follows:
|
||||
(graph
|
||||
, **\ \*(boost::mpl::and_<
|
||||
boost::is_convertible<
|
||||
boost::graph_traits<_>::traversal_category
|
||||
, boost::incidence_graph_tag
|
||||
traversal_category<_>, boost::incidence_graph_tag
|
||||
>
|
||||
, boost::is_convertible<
|
||||
boost::graph_traits<_>::traversal_category
|
||||
, boost::vertex_list_graph_tag
|
||||
traversal_category<_>, boost::vertex_list_graph_tag
|
||||
>
|
||||
>)** ))
|
||||
|
||||
@@ -876,25 +912,21 @@ in parentheses *and preceded by an asterix*, as follows:
|
||||
(visitor, \*, boost::dfs_visitor<>()) // not checkable
|
||||
|
||||
(root_vertex
|
||||
, (typename boost::graph_traits<graphs::graph::_>::vertex_descriptor)
|
||||
, (vertex_descriptor<graphs::graph::_>)
|
||||
, \*vertices(graph).first)
|
||||
|
||||
(index_map
|
||||
, **\ \*(boost::mpl::and_<
|
||||
boost::is_integral<
|
||||
boost::property_traits<_>::value_type
|
||||
>
|
||||
boost::is_integral<value_type<_> >
|
||||
, boost::is_same<
|
||||
typename boost::graph_traits<graphs::graph::_>::vertex_descriptor
|
||||
, boost::property_traits<_>::key_type
|
||||
vertex_descriptor<graphs::graph::_>, key_type<_>
|
||||
>
|
||||
>)**
|
||||
, get(boost::vertex_index,graph))
|
||||
|
||||
(in_out(color_map)
|
||||
, **\ \*(boost::is_same<
|
||||
typename boost::graph_traits<graphs::graph::_>::vertex_descriptor
|
||||
, boost::property_traits<_>::key_type
|
||||
vertex_descriptor<graphs::graph::_>, key_type<_>
|
||||
>)**
|
||||
, default_color_map(num_vertices(graph), index_map) )
|
||||
)
|
||||
@@ -902,6 +934,8 @@ in parentheses *and preceded by an asterix*, as follows:
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/graph/depth_first_search.hpp>
|
||||
|
||||
BOOST_PARAMETER_NAME((_graph, graphs) graph)
|
||||
BOOST_PARAMETER_NAME((_visitor, graphs) visitor)
|
||||
@@ -910,38 +944,37 @@ in parentheses *and preceded by an asterix*, as follows:
|
||||
BOOST_PARAMETER_NAME((_color_map, graphs) color_map)
|
||||
|
||||
using boost::mpl::_;
|
||||
|
||||
namespace boost
|
||||
{
|
||||
struct incidence_graph_tag {};
|
||||
struct vertex_list_graph_tag {};
|
||||
|
||||
int vertex_index = 0;
|
||||
|
||||
template <class T>
|
||||
struct graph_traits
|
||||
{
|
||||
typedef int traversal_category;
|
||||
typedef int vertex_descriptor;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct property_traits
|
||||
{
|
||||
typedef int value_type;
|
||||
typedef int key_type;
|
||||
};
|
||||
|
||||
template <class T = int>
|
||||
struct dfs_visitor
|
||||
{};
|
||||
}''')
|
||||
''')
|
||||
|
||||
.. @example.append('''
|
||||
{}''')
|
||||
{}
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> G;
|
||||
|
||||
enum {u, v, w, x, y, z, N};
|
||||
typedef std::pair<int, int> E;
|
||||
E edges[] = {E(u, v), E(u, x), E(x, v), E(y, x), E(v, y), E(w, y),
|
||||
E(w,z), E(z, z)};
|
||||
G g(edges, edges + sizeof(edges) / sizeof(E), N);
|
||||
|
||||
depth_first_search(g);
|
||||
depth_first_search(g, _root_vertex = (int)x);
|
||||
}
|
||||
''')
|
||||
|
||||
.. @test('compile')
|
||||
|
||||
Note the use of the nested `tag::_`. This is a shortcut for::
|
||||
|
||||
value_type<boost::mpl::_2, tag>
|
||||
|
||||
.. @ignore()
|
||||
|
||||
Intended to be used to access preceding arguments types in the
|
||||
predicates.
|
||||
|
||||
__ ../../../mpl/doc/refmanual/metafunction.html
|
||||
|
||||
We acknowledge that this signature is pretty hairy looking.
|
||||
@@ -1112,7 +1145,7 @@ be used within the body of a class::
|
||||
struct callable2
|
||||
{
|
||||
BOOST_PARAMETER_CONST_MEMBER_FUNCTION(
|
||||
(void), operator(), tag, (required (arg1,(int))(arg2,(int))))
|
||||
(void), call, tag, (required (arg1,(int))(arg2,(int))))
|
||||
{
|
||||
std::cout << arg1 << ", " << arg2 << std::endl;
|
||||
}
|
||||
@@ -1120,7 +1153,9 @@ be used within the body of a class::
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>''')
|
||||
#include <iostream>
|
||||
using namespace boost::parameter;
|
||||
''')
|
||||
|
||||
.. @test('compile')
|
||||
|
||||
@@ -1131,7 +1166,7 @@ arguments on to a separate implementation function::
|
||||
struct callable2
|
||||
{
|
||||
BOOST_PARAMETER_CONST_MEMBER_FUNCTION(
|
||||
(void), operator(), tag, (required (arg1,(int))(arg2,(int))))
|
||||
(void), call, tag, (required (arg1,(int))(arg2,(int))))
|
||||
{
|
||||
call_impl(arg1,arg2);
|
||||
}
|
||||
@@ -1143,10 +1178,40 @@ arguments on to a separate implementation function::
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
BOOST_PARAMETER_NAME(arg1)
|
||||
BOOST_PARAMETER_NAME(arg2)''')
|
||||
BOOST_PARAMETER_NAME(arg2)
|
||||
using namespace boost::parameter;
|
||||
''')
|
||||
|
||||
.. @test('compile')
|
||||
|
||||
Static Member Functions
|
||||
=======================
|
||||
|
||||
To expose a static member function, simply insert the keyword
|
||||
“``static``” before the function name:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
BOOST_PARAMETER_NAME(arg1)
|
||||
|
||||
struct somebody
|
||||
{
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION(
|
||||
(void), **static** f, tag, (optional (arg1,(int),0)))
|
||||
{
|
||||
std::cout << arg1 << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
using namespace boost::parameter;
|
||||
''')
|
||||
|
||||
.. @test('compile')
|
||||
|
||||
|
||||
------------------------------
|
||||
Parameter-Enabled Constructors
|
||||
------------------------------
|
||||
@@ -1339,10 +1404,10 @@ separately)::
|
||||
using boost::mpl::_;
|
||||
|
||||
typedef parameter::parameters<
|
||||
required<tag::class_type, is_class<_> >
|
||||
, optional<tag::base_list, mpl::is_sequence<_> >
|
||||
, optional<tag::held_type>
|
||||
, optional<tag::copyable>
|
||||
required<tag::class_type, boost::is_class<_> >
|
||||
, parameter::optional<tag::base_list, mpl::is_sequence<_> >
|
||||
, parameter::optional<tag::held_type>
|
||||
, parameter::optional<tag::copyable>
|
||||
> class_signature;
|
||||
|
||||
}}
|
||||
@@ -1351,6 +1416,7 @@ separately)::
|
||||
#include <boost/parameter.hpp>
|
||||
#include <boost/mpl/is_sequence.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
#include <memory>
|
||||
|
||||
using namespace boost::parameter;
|
||||
@@ -1377,12 +1443,13 @@ separately)::
|
||||
Argument Packs and Parameter Extraction
|
||||
---------------------------------------
|
||||
|
||||
Next, within the body of ``class_`` , we use the |ParameterSpec|\
|
||||
's nested ``::bind< … >`` template to bundle the actual arguments
|
||||
into an |ArgumentPack|_ type, and then use the library's ``binding<
|
||||
… >`` metafunction to extract “logical parameters”. Note that
|
||||
defaults are specified by supplying an optional third argument to
|
||||
``binding< … >``::
|
||||
Next, within the body of ``class_`` , we use the |ParameterSpec|\ 's
|
||||
nested ``::bind< … >`` template to bundle the actual arguments into an
|
||||
|ArgumentPack|_ type, and then use the library's ``value_type< … >``
|
||||
metafunction to extract “logical parameters”. ``value_type< … >`` is
|
||||
a lot like ``binding< … >``, but no reference is added to the actual
|
||||
argument type. Note that defaults are specified by passing it an
|
||||
optional third argument::
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -1400,16 +1467,16 @@ defaults are specified by supplying an optional third argument to
|
||||
args;
|
||||
|
||||
// Extract first logical parameter.
|
||||
typedef typename parameter::binding<
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::class_type>::type class_type;
|
||||
|
||||
typedef typename parameter::binding<
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::base_list, bases<> >::type base_list;
|
||||
|
||||
typedef typename parameter::binding<
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::held_type, class_type>::type held_type;
|
||||
|
||||
typedef typename parameter::binding<
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::copyable, void>::type copyable;
|
||||
};
|
||||
|
||||
@@ -1511,12 +1578,12 @@ parameters deducible::
|
||||
typedef parameter::parameters<
|
||||
required<tag::class_type, is_class<_> >
|
||||
|
||||
, optional<
|
||||
, parameter::optional<
|
||||
deduced<tag::base_list>
|
||||
, is_base_and_derived<detail::bases_base,_>
|
||||
>
|
||||
|
||||
, optional<
|
||||
, parameter::optional<
|
||||
deduced<tag::held_type>
|
||||
, mpl::not_<
|
||||
mpl::or_<
|
||||
@@ -1526,11 +1593,12 @@ parameters deducible::
|
||||
>
|
||||
>
|
||||
|
||||
, optional<deduced<tag::copyable>, is_same<noncopyable,_> >
|
||||
, parameter::optional<deduced<tag::copyable>, is_same<noncopyable,_> >
|
||||
|
||||
> class_signature;
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
namespace boost { namespace python {''')
|
||||
|
||||
.. @example.append('''
|
||||
@@ -1548,16 +1616,16 @@ parameters deducible::
|
||||
args;
|
||||
|
||||
// Extract first logical parameter.
|
||||
typedef typename parameter::binding<
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::class_type>::type class_type;
|
||||
|
||||
typedef typename parameter::binding<
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::base_list, bases<> >::type base_list;
|
||||
|
||||
typedef typename parameter::binding<
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::held_type, class_type>::type held_type;
|
||||
|
||||
typedef typename parameter::binding<
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::copyable, void>::type copyable;
|
||||
};
|
||||
|
||||
@@ -1778,15 +1846,13 @@ function template and allow *it* to do type deduction::
|
||||
Occasionally one needs to deduce argument types without an extra
|
||||
layer of function call. For example, suppose we wanted to return
|
||||
twice the value of the ``index`` parameter? In that
|
||||
case we can use the ``binding< … >`` metafunction introduced
|
||||
case we can use the ``value_type< … >`` metafunction introduced
|
||||
`earlier`__::
|
||||
|
||||
BOOST_PARAMETER_NAME(index)
|
||||
|
||||
template <class ArgumentPack>
|
||||
typename remove_reference<
|
||||
typename parameter::binding<ArgumentPack, tag::index, int>::type
|
||||
>::type
|
||||
typename parameter::value_type<ArgumentPack, tag::index, int>::type
|
||||
twice_index(ArgumentPack const& args)
|
||||
{
|
||||
return 2 * args[_index|42];
|
||||
@@ -1800,39 +1866,20 @@ case we can use the ``binding< … >`` metafunction introduced
|
||||
#include <cassert>
|
||||
|
||||
namespace parameter = boost::parameter;
|
||||
using boost::remove_reference;''')
|
||||
|
||||
Note that the ``remove_reference< … >`` dance is necessary because
|
||||
``binding< … >`` will return a reference type when the argument
|
||||
is bound in the argument pack. If we don't strip the reference we
|
||||
end up returning a reference to the temporary created in the ``2 * …``
|
||||
expression. A convenient shortcut would be to use the ``value_type< … >``
|
||||
metafunction:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
template <class ArgumentPack>
|
||||
typename **parameter::value_type<ArgumentPack, tag::index, int>**::type
|
||||
twice_index(ArgumentPack const& args)
|
||||
{
|
||||
return 2 * args[_index|42];
|
||||
}
|
||||
|
||||
.. @example.wrap('namespace with_value_type {', '''
|
||||
int six = twice_index(_index = 3);
|
||||
}''')
|
||||
|
||||
.. TODO: binding<> returns a reference. We should use value_type<> here.
|
||||
''')
|
||||
|
||||
.. @example.append('''
|
||||
int main()
|
||||
{
|
||||
assert(six == 6);
|
||||
assert(with_value_type::six == 6);
|
||||
}''')
|
||||
|
||||
.. @test('run', howmany='all')
|
||||
|
||||
Note that if we had used ``binding< … >`` rather than ``value_type< …
|
||||
>``, we would end up returning a reference to the temporary created in
|
||||
the ``2 * …`` expression.
|
||||
|
||||
__ binding_intro_
|
||||
|
||||
Lazy Default Computation
|
||||
@@ -1888,12 +1935,10 @@ object.
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
using boost::bind;
|
||||
using boost::ref;
|
||||
|
||||
typename parameter::binding<
|
||||
ArgumentPack, tag::s3, std::string
|
||||
>::type s3 = args[_s3 **|| bind(std::plus<std::string>(), ref(s1), ref(s2))** ];
|
||||
>::type s3 = args[_s3
|
||||
**|| boost::bind(std::plus<std::string>(), boost::ref(s1), boost::ref(s2))** ];
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
The Boost Parameter Library Python Binding Documentation
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
:Authors: Daniel Wallin
|
||||
:Contact: dalwan01@student.umu.se
|
||||
:organization: `Boost Consulting`_
|
||||
:Authors: David Abrahams, Daniel Wallin
|
||||
:Contact: dave@boost-consulting.com, daniel@boostpro.com
|
||||
:organization: `BoostPro Computing`_
|
||||
:date: $Date$
|
||||
|
||||
:copyright: Copyright David Abrahams, Daniel Wallin
|
||||
2005. Distributed under the Boost Software License,
|
||||
2005-2009. 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)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
__ ../../../../index.htm
|
||||
|
||||
.. _`Boost Consulting`: http://www.boost-consulting.com
|
||||
.. _`BoostPro Computing`: http://www.boostpro.com
|
||||
|
||||
|
||||
.. role:: class
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
:Authors: David Abrahams, Daniel Wallin
|
||||
:Contact: dave@boost-consulting.com, dalwan01@student.umu.se
|
||||
:organization: `Boost Consulting`_
|
||||
:Contact: dave@boost-consulting.com, daniel@boostpro.com
|
||||
:organization: `BoostPro Computing`_
|
||||
:date: $Date: 2005/07/17 19:53:01 $
|
||||
|
||||
:copyright: Copyright David Abrahams, Daniel Wallin
|
||||
2005. Distributed under the Boost Software License,
|
||||
2005-2009. 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)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
__ ../../../../index.htm
|
||||
|
||||
.. _`Boost Consulting`: http://www.boost-consulting.com
|
||||
.. _`BoostPro Computing`: http://www.boostpro.com
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -970,7 +970,7 @@ already ``#defined``.
|
||||
|
||||
__ ../../../../boost/parameter/config.hpp
|
||||
|
||||
:Default Value: ``5``
|
||||
:Default Value: ``8``
|
||||
|
||||
Tutorial
|
||||
========
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <boost/parameter/aux_/default.hpp>
|
||||
#include <boost/parameter/aux_/parameter_requirements.hpp>
|
||||
#include <boost/parameter/aux_/yesno.hpp>
|
||||
#include <boost/parameter/aux_/maybe.hpp>
|
||||
#include <boost/parameter/aux_/is_maybe.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#include <boost/mpl/apply.hpp>
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
// Forward declaration for aux::arg_list, below.
|
||||
template<class T> struct keyword;
|
||||
@@ -46,7 +46,7 @@ struct lambda_tag;
|
||||
// declarations to build member function overload sets that can
|
||||
// match against keywords.
|
||||
//
|
||||
|
||||
|
||||
// MPL sequence support
|
||||
struct arg_list_tag;
|
||||
|
||||
@@ -83,14 +83,14 @@ struct empty_arg_list
|
||||
template <class KW>
|
||||
static no_tag has_key(KW*);
|
||||
#endif
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|
||||
|| (BOOST_WORKAROUND(__GNUC__, < 3)) \
|
||||
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
|
||||
|
||||
// The overload set technique doesn't work with these older
|
||||
// compilers, so they need some explicit handholding.
|
||||
|
||||
|
||||
// A metafunction class that, given a keyword, returns the type
|
||||
// of the base sublist whose get() function can produce the
|
||||
// value for that key
|
||||
@@ -159,11 +159,6 @@ no_tag operator*(empty_arg_list, KW*);
|
||||
template <class KW, class T>
|
||||
struct tagged_argument;
|
||||
|
||||
template <class T>
|
||||
struct is_maybe
|
||||
: is_base_and_derived<maybe_base, T>
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct get_reference
|
||||
{
|
||||
@@ -211,9 +206,9 @@ struct arg_list : Next
|
||||
// Create a new list by prepending arg to a copy of tail. Used
|
||||
// when incrementally building this structure with the comma
|
||||
// operator.
|
||||
arg_list(TaggedArg arg, Next const& tail)
|
||||
arg_list(TaggedArg head, Next const& tail)
|
||||
: Next(tail)
|
||||
, arg(arg)
|
||||
, arg(head)
|
||||
{}
|
||||
|
||||
// A metafunction class that, given a keyword and a default
|
||||
@@ -241,8 +236,8 @@ struct arg_list : Next
|
||||
// same keyword is used again
|
||||
static yes_tag has_key(key_type*);
|
||||
using Next::has_key;
|
||||
|
||||
# define BOOST_PARAMETER_CALL_HAS_KEY(next, key) next::has_key((key*)0)
|
||||
|
||||
# define BOOST_PARAMETER_CALL_HAS_KEY(next, key) next::has_key((key*)0)
|
||||
# endif
|
||||
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
@@ -257,7 +252,7 @@ struct arg_list : Next
|
||||
// specific arguments by name
|
||||
//
|
||||
|
||||
// Helpers that handle the case when TaggedArg is
|
||||
// Helpers that handle the case when TaggedArg is
|
||||
// empty<T>.
|
||||
template <class D>
|
||||
reference get_default(D const&, mpl::false_) const
|
||||
@@ -337,7 +332,7 @@ struct arg_list : Next
|
||||
template <class Default>
|
||||
reference get(default_<key_type,Default> const& d) const
|
||||
{
|
||||
return get_default(d, holds_maybe());
|
||||
return get_default(d, holds_maybe());
|
||||
}
|
||||
|
||||
template <class Default>
|
||||
@@ -345,7 +340,7 @@ struct arg_list : Next
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
reference operator[](keyword<key_type> const&) const
|
||||
@@ -400,7 +395,7 @@ struct arg_list : Next
|
||||
// Comma operator to compose argument list without using parameters<>.
|
||||
// Useful for argument lists with undetermined length.
|
||||
template <class KW, class T2>
|
||||
arg_list<tagged_argument<KW, T2>, self>
|
||||
arg_list<tagged_argument<KW, T2>, self>
|
||||
operator,(tagged_argument<KW,T2> x) const
|
||||
{
|
||||
return arg_list<tagged_argument<KW,T2>, self>(x, *this);
|
||||
@@ -414,7 +409,7 @@ struct arg_list : Next
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // ETI workaround
|
||||
template <> struct arg_list<int,int> {};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// MPL sequence support
|
||||
template <class ArgumentPack>
|
||||
@@ -424,7 +419,7 @@ struct arg_list_iterator
|
||||
|
||||
// The incremented iterator
|
||||
typedef arg_list_iterator<typename ArgumentPack::tail_type> next;
|
||||
|
||||
|
||||
// dereferencing yields the key type
|
||||
typedef typename ArgumentPack::key_type type;
|
||||
};
|
||||
|
||||
@@ -40,11 +40,11 @@ struct use_default_tag {};
|
||||
// X(something, *(predicate))
|
||||
// X(something, (int))
|
||||
|
||||
template <class T>
|
||||
template <class T, class Args>
|
||||
struct cast;
|
||||
|
||||
template <>
|
||||
struct cast<void*>
|
||||
template <class Args>
|
||||
struct cast<void*, Args>
|
||||
{
|
||||
static use_default_tag execute(use_default_tag)
|
||||
{
|
||||
@@ -73,27 +73,39 @@ struct cast<void*>
|
||||
|
||||
typedef void* voidstar;
|
||||
|
||||
template <class T>
|
||||
struct cast<voidstar(T)>
|
||||
: cast<void*>
|
||||
template <class T, class Args>
|
||||
struct cast<voidstar(T), Args>
|
||||
: cast<void*, Args>
|
||||
{
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <class T>
|
||||
struct cast<void*(T)>
|
||||
: cast<void*>
|
||||
template <class T, class Args>
|
||||
struct cast<void*(T), Args>
|
||||
: cast<void*, Args>
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
struct cast<void(T)>
|
||||
// This is a hack used in cast<> to turn the user supplied type,
|
||||
// which may or may not be a placeholder expression into one, so
|
||||
// that it will be properly evaluated by mpl::apply.
|
||||
template <class T, class Dummy = mpl::_1>
|
||||
struct as_placeholder_expr
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <class T, class Args>
|
||||
struct cast<void(T), Args>
|
||||
{
|
||||
typedef typename mpl::apply2<
|
||||
as_placeholder_expr<T>, Args, Args>::type type0;
|
||||
|
||||
typedef typename boost::add_reference<
|
||||
typename boost::remove_const<T>::type
|
||||
typename boost::remove_const<type0>::type
|
||||
>::type reference;
|
||||
|
||||
static use_default_tag execute(use_default_tag)
|
||||
@@ -106,7 +118,7 @@ struct cast<void(T)>
|
||||
return use_default_tag();
|
||||
}
|
||||
|
||||
static T execute(T value)
|
||||
static type0 execute(type0 value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
@@ -118,9 +130,9 @@ struct cast<void(T)>
|
||||
}
|
||||
};
|
||||
|
||||
# define BOOST_PARAMETER_FUNCTION_CAST(value, predicate) \
|
||||
boost::parameter::aux::cast<void predicate>::remove_const( \
|
||||
boost::parameter::aux::cast<void predicate>::execute(value) \
|
||||
# define BOOST_PARAMETER_FUNCTION_CAST(value, predicate, args) \
|
||||
boost::parameter::aux::cast<void predicate, args>::remove_const( \
|
||||
boost::parameter::aux::cast<void predicate, args>::execute(value) \
|
||||
)
|
||||
|
||||
# endif
|
||||
|
||||
26
include/boost/parameter/aux_/is_maybe.hpp
Normal file
26
include/boost/parameter/aux_/is_maybe.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright Daniel Wallin, David Abrahams 2010. Use, modification and
|
||||
// distribution is subject to 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)
|
||||
|
||||
#ifndef BOOST_PARAMETER_IS_MAYBE_050329_HPP
|
||||
#define BOOST_PARAMETER_IS_MAYBE_050329_HPP
|
||||
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace parameter {
|
||||
namespace aux {
|
||||
|
||||
struct maybe_base {};
|
||||
|
||||
template <class T>
|
||||
struct is_maybe
|
||||
: is_base_and_derived<maybe_base, T>
|
||||
{};
|
||||
|
||||
} // namespace aux
|
||||
} // namespace parameter
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_PARAMETER_IS_MAYBE_050329_HPP
|
||||
@@ -2,21 +2,41 @@
|
||||
// subject to 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)
|
||||
|
||||
#ifndef BOOST_PARAMETER_MAYBE_060211_HPP
|
||||
# define BOOST_PARAMETER_MAYBE_060211_HPP
|
||||
//
|
||||
// 2009.10.21 TDS remove depenency on boost::python::detail::referent_storage
|
||||
//
|
||||
#ifndef BOOST_PARAMETER_MAYBE_091021_HPP
|
||||
# define BOOST_PARAMETER_MAYBE_091021_HPP
|
||||
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/mpl/identity.hpp>
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/optional.hpp>
|
||||
# include <boost/python/detail/referent_storage.hpp>
|
||||
# include <boost/aligned_storage.hpp>
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
# include <boost/parameter/aux_/is_maybe.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
struct maybe_base {};
|
||||
template <class T> struct referent_size;
|
||||
|
||||
template <class T>
|
||||
struct referent_size<T&>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = sizeof(T));
|
||||
};
|
||||
|
||||
// A metafunction returning a POD type which can store U, where T ==
|
||||
// U&. If T is not a reference type, returns a POD which can store T.
|
||||
template <class T>
|
||||
struct referent_storage
|
||||
{
|
||||
typedef typename boost::aligned_storage<
|
||||
referent_size<T>::value
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct maybe : maybe_base
|
||||
@@ -24,17 +44,17 @@ struct maybe : maybe_base
|
||||
typedef typename add_reference<
|
||||
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
T const
|
||||
# else
|
||||
# else
|
||||
typename add_const<T>::type
|
||||
# endif
|
||||
# endif
|
||||
>::type reference;
|
||||
|
||||
|
||||
typedef typename remove_cv<
|
||||
BOOST_DEDUCED_TYPENAME remove_reference<reference>::type
|
||||
>::type non_cv_value;
|
||||
|
||||
explicit maybe(T value)
|
||||
: value(value)
|
||||
|
||||
explicit maybe(T value_)
|
||||
: value(value_)
|
||||
, constructed(false)
|
||||
{}
|
||||
|
||||
@@ -48,28 +68,28 @@ struct maybe : maybe_base
|
||||
this->destroy();
|
||||
}
|
||||
|
||||
reference construct(reference value) const
|
||||
reference construct(reference value_) const
|
||||
{
|
||||
return value;
|
||||
return value_;
|
||||
}
|
||||
|
||||
template <class U>
|
||||
reference construct2(U const& value) const
|
||||
reference construct2(U const& value_) const
|
||||
{
|
||||
new (m_storage.bytes) non_cv_value(value);
|
||||
new (m_storage.address()) non_cv_value(value_);
|
||||
constructed = true;
|
||||
return *(non_cv_value*)m_storage.bytes;
|
||||
return *(non_cv_value*)m_storage.address();
|
||||
}
|
||||
|
||||
template <class U>
|
||||
reference construct(U const& value) const
|
||||
reference construct(U const& value_) const
|
||||
{
|
||||
return this->construct2(value);
|
||||
return this->construct2(value_);
|
||||
}
|
||||
|
||||
void destroy()
|
||||
{
|
||||
((non_cv_value*)m_storage.bytes)->~non_cv_value();
|
||||
((non_cv_value*)m_storage.address())->~non_cv_value();
|
||||
}
|
||||
|
||||
typedef reference(maybe<T>::*safe_bool)() const;
|
||||
@@ -87,7 +107,9 @@ struct maybe : maybe_base
|
||||
private:
|
||||
boost::optional<T> value;
|
||||
mutable bool constructed;
|
||||
mutable typename boost::python::detail::referent_storage<
|
||||
|
||||
|
||||
mutable typename referent_storage<
|
||||
reference
|
||||
>::type m_storage;
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define BOOST_PARAMETER_CONFIG_050403_HPP
|
||||
|
||||
#ifndef BOOST_PARAMETER_MAX_ARITY
|
||||
# define BOOST_PARAMETER_MAX_ARITY 5
|
||||
# define BOOST_PARAMETER_MAX_ARITY 8
|
||||
#endif
|
||||
|
||||
#endif // BOOST_PARAMETER_CONFIG_050403_HPP
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace boost { namespace parameter { namespace aux {
|
||||
// Tag type passed to MPL lambda.
|
||||
struct lambda_tag;
|
||||
|
||||
struct name_tag_base
|
||||
struct name_tag_base
|
||||
{};
|
||||
|
||||
template <class Tag>
|
||||
@@ -46,7 +46,7 @@ namespace boost { namespace mpl {
|
||||
template <class T>
|
||||
struct lambda<
|
||||
T
|
||||
, typename enable_if<
|
||||
, typename boost::enable_if<
|
||||
parameter::aux::is_name_tag<T>, parameter::aux::lambda_tag
|
||||
>::type
|
||||
>
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
# include <boost/parameter/aux_/preprocessor/flatten.hpp>
|
||||
|
||||
# include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
# include <boost/preprocessor/comparison/equal.hpp>
|
||||
# include <boost/preprocessor/control/if.hpp>
|
||||
# include <boost/preprocessor/control/iif.hpp>
|
||||
# include <boost/preprocessor/control/expr_if.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
@@ -23,9 +25,12 @@
|
||||
# include <boost/preprocessor/seq/for_each_product.hpp>
|
||||
# include <boost/preprocessor/seq/for_each_i.hpp>
|
||||
# include <boost/preprocessor/tuple/elem.hpp>
|
||||
# include <boost/preprocessor/tuple/eat.hpp>
|
||||
# include <boost/preprocessor/seq/fold_left.hpp>
|
||||
# include <boost/preprocessor/seq/push_back.hpp>
|
||||
# include <boost/preprocessor/seq/size.hpp>
|
||||
# include <boost/preprocessor/seq/enum.hpp>
|
||||
# include <boost/preprocessor/seq/push_back.hpp>
|
||||
|
||||
# include <boost/preprocessor/detail/is_nullary.hpp>
|
||||
|
||||
@@ -358,7 +363,7 @@ struct funptr_predicate<void**>
|
||||
# define BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z(z, name, parameters, n) \
|
||||
, typename boost::parameter::aux::match< \
|
||||
parameters, BOOST_PP_ENUM_PARAMS(n, ParameterArgumentType) \
|
||||
>::type boost_parameter_enabler_argument = parameters()
|
||||
>::type = parameters()
|
||||
# else
|
||||
# define BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z(z, name, parameters, n)
|
||||
# endif
|
||||
@@ -696,6 +701,7 @@ struct funptr_predicate<void**>
|
||||
) \
|
||||
] \
|
||||
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
|
||||
, Args \
|
||||
)
|
||||
|
||||
# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_BODY(name, n, split_args, tag_namespace) \
|
||||
@@ -723,6 +729,7 @@ struct funptr_predicate<void**>
|
||||
BOOST_PARAMETER_FUNCTION_CAST( \
|
||||
boost::parameter::aux::as_lvalue(BOOST_PARAMETER_FN_ARG_DEFAULT(arg), 0L) \
|
||||
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
|
||||
, Args \
|
||||
)
|
||||
|
||||
# define BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT_BODY(name, n, split_args, tag_ns, const_) \
|
||||
@@ -838,6 +845,7 @@ struct funptr_predicate<void**>
|
||||
boost::parameter::keyword<tag_ns::BOOST_PARAMETER_FN_ARG_KEYWORD(arg)>::instance \
|
||||
] \
|
||||
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
|
||||
, Args \
|
||||
)
|
||||
|
||||
// Generates the function template that recives a ArgumentPack, and then
|
||||
|
||||
@@ -9,6 +9,8 @@ import python ;
|
||||
project boost/parameter
|
||||
: default-build <warnings>off
|
||||
;
|
||||
|
||||
build-project literate ;
|
||||
|
||||
test-suite "parameter"
|
||||
: [ run basics.cpp ]
|
||||
|
||||
33
test/literate/Jamfile.v2
Normal file
33
test/literate/Jamfile.v2
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
import testing ;
|
||||
|
||||
run extracting-parameter-types0.cpp ;
|
||||
run extracting-parameter-types1.cpp ;
|
||||
compile template-keywords0.cpp ;
|
||||
compile template-keywords1.cpp ;
|
||||
compile top-level0.cpp ;
|
||||
compile headers-and-namespaces0.cpp ;
|
||||
compile predicate-requirements0.cpp ;
|
||||
compile handling-out-parameters0.cpp ;
|
||||
compile writing-the-function0.cpp ;
|
||||
run building-argumentpacks0.cpp ;
|
||||
compile defining-the-keywords0.cpp ;
|
||||
compile defining-the-keywords1.cpp ;
|
||||
compile exercising-the-code-so-far0.cpp ;
|
||||
run lazy-default-computation0.cpp ;
|
||||
run lazy-default-computation1.cpp ;
|
||||
run namespaces0.cpp ;
|
||||
run namespaces1.cpp ;
|
||||
run namespaces2.cpp ;
|
||||
run namespaces3.cpp ;
|
||||
compile optional-parameters0.cpp ;
|
||||
compile static-member-functions0.cpp ;
|
||||
run parameter-enabled-constructors0.cpp ;
|
||||
compile required-parameters0.cpp ;
|
||||
compile class-template-skeleton0.cpp ;
|
||||
compile deduced-template-parameters0.cpp ;
|
||||
compile deduced-parameters0.cpp ;
|
||||
compile default-expression-evaluation0.cpp ;
|
||||
compile parameter-enabled-member-functions0.cpp ;
|
||||
compile parameter-enabled-member-functions1.cpp ;
|
||||
run fine-grained-name-control0.cpp ;
|
||||
6
test/literate/README
Normal file
6
test/literate/README
Normal file
@@ -0,0 +1,6 @@
|
||||
These tests were extracted from the Boost.Parameter documentation
|
||||
with:
|
||||
|
||||
python ../../../../tools/litre/tool.py \
|
||||
../../../../libs/parameter/doc/index.rst \
|
||||
--dump_dir=.
|
||||
53
test/literate/building-argumentpacks0.cpp
Normal file
53
test/literate/building-argumentpacks0.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
#line 1744 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
#line 1733 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
BOOST_PARAMETER_NAME(index)
|
||||
|
||||
template <class ArgumentPack>
|
||||
int print_index(ArgumentPack const& args)
|
||||
{
|
||||
std::cout << "index = " << args[_index] << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int x = print_index(_index = 3); // prints "index = 3"
|
||||
|
||||
#line 1752 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
BOOST_PARAMETER_NAME(name)
|
||||
|
||||
template <class ArgumentPack>
|
||||
int print_name_and_index(ArgumentPack const& args)
|
||||
{
|
||||
std::cout << "name = " << args[_name] << "; ";
|
||||
return print_index(args);
|
||||
}
|
||||
|
||||
int y = print_name_and_index((_index = 3, _name = "jones"));
|
||||
|
||||
|
||||
#line 1787 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace parameter = boost::parameter;
|
||||
using parameter::required;
|
||||
using parameter::optional;
|
||||
using boost::is_convertible;
|
||||
using boost::mpl::_;
|
||||
#line 1773 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
parameter::parameters<
|
||||
required<tag::name, is_convertible<_,char const*> >
|
||||
, optional<tag::index, is_convertible<_,int> >
|
||||
> spec;
|
||||
|
||||
char const sam[] = "sam";
|
||||
int twelve = 12;
|
||||
|
||||
int z0 = print_name_and_index( spec(sam, twelve) );
|
||||
|
||||
int z1 = print_name_and_index(
|
||||
spec(_index=12, _name="sam")
|
||||
);
|
||||
#line 1794 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
int main()
|
||||
{}
|
||||
|
||||
18
test/literate/class-template-skeleton0.cpp
Normal file
18
test/literate/class-template-skeleton0.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
#line 1387 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#line 1373 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace boost { namespace python {
|
||||
|
||||
template <
|
||||
class A0
|
||||
, class A1 = parameter::void_
|
||||
, class A2 = parameter::void_
|
||||
, class A3 = parameter::void_
|
||||
>
|
||||
struct class_
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
}}
|
||||
80
test/literate/deduced-parameters0.cpp
Normal file
80
test/literate/deduced-parameters0.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
|
||||
#line 1062 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
BOOST_PARAMETER_NAME(name)
|
||||
BOOST_PARAMETER_NAME(func)
|
||||
BOOST_PARAMETER_NAME(docstring)
|
||||
BOOST_PARAMETER_NAME(keywords)
|
||||
BOOST_PARAMETER_NAME(policies)
|
||||
|
||||
struct default_call_policies
|
||||
{};
|
||||
|
||||
struct no_keywords
|
||||
{};
|
||||
|
||||
struct keywords
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct is_keyword_expression
|
||||
: boost::mpl::false_
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct is_keyword_expression<keywords>
|
||||
: boost::mpl::true_
|
||||
{};
|
||||
|
||||
default_call_policies some_policies;
|
||||
|
||||
void f()
|
||||
{}
|
||||
#line 1029 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(void), def, tag,
|
||||
|
||||
(required (name,(char const*)) (func,*) ) // nondeduced
|
||||
|
||||
(deduced
|
||||
(optional
|
||||
(docstring, (char const*), "")
|
||||
|
||||
(keywords
|
||||
, *(is_keyword_expression<mpl::_>) // see 5
|
||||
, no_keywords())
|
||||
|
||||
(policies
|
||||
, *(mpl::not_<
|
||||
mpl::or_<
|
||||
boost::is_convertible<mpl::_, char const*>
|
||||
, is_keyword_expression<mpl::_> // see 5
|
||||
>
|
||||
>)
|
||||
, default_call_policies()
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
#line 1111 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
int main()
|
||||
{
|
||||
#line 1108 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
def("f", &f, some_policies, "Documentation for f");
|
||||
def("f", &f, "Documentation for f", some_policies);
|
||||
|
||||
#line 1121 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
def(
|
||||
"f", &f
|
||||
, _policies = some_policies, "Documentation for f");
|
||||
#line 1124 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
}
|
||||
|
||||
111
test/literate/deduced-template-parameters0.cpp
Normal file
111
test/literate/deduced-template-parameters0.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
|
||||
#line 1557 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <boost/mpl/is_sequence.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <memory>
|
||||
|
||||
using namespace boost::parameter;
|
||||
using boost::mpl::_;
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(class_type)
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(base_list)
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(held_type)
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(copyable)
|
||||
|
||||
}}
|
||||
#line 1546 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace boost { namespace python {
|
||||
|
||||
namespace detail { struct bases_base {}; }
|
||||
|
||||
template <class A0 = void, class A1 = void, class A2 = void >
|
||||
struct bases : detail::bases_base
|
||||
{};
|
||||
|
||||
}}
|
||||
|
||||
|
||||
#line 1600 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
namespace boost { namespace python {
|
||||
#line 1578 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
typedef parameter::parameters<
|
||||
required<tag::class_type, is_class<_> >
|
||||
|
||||
, parameter::optional<
|
||||
deduced<tag::base_list>
|
||||
, is_base_and_derived<detail::bases_base,_>
|
||||
>
|
||||
|
||||
, parameter::optional<
|
||||
deduced<tag::held_type>
|
||||
, mpl::not_<
|
||||
mpl::or_<
|
||||
is_base_and_derived<detail::bases_base,_>
|
||||
, is_same<noncopyable,_>
|
||||
>
|
||||
>
|
||||
>
|
||||
|
||||
, parameter::optional<deduced<tag::copyable>, is_same<noncopyable,_> >
|
||||
|
||||
> class_signature;
|
||||
#line 1604 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
template <
|
||||
class A0
|
||||
, class A1 = parameter::void_
|
||||
, class A2 = parameter::void_
|
||||
, class A3 = parameter::void_
|
||||
>
|
||||
struct class_
|
||||
{
|
||||
// Create ArgumentPack
|
||||
typedef typename
|
||||
class_signature::bind<A0,A1,A2,A3>::type
|
||||
args;
|
||||
|
||||
// Extract first logical parameter.
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::class_type>::type class_type;
|
||||
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::base_list, bases<> >::type base_list;
|
||||
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::held_type, class_type>::type held_type;
|
||||
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::copyable, void>::type copyable;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
|
||||
|
||||
#line 1644 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
struct B {};
|
||||
struct D {};
|
||||
|
||||
using boost::python::bases;
|
||||
#line 1640 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
typedef boost::python::class_<B, boost::noncopyable> c1;
|
||||
|
||||
typedef boost::python::class_<D, std::auto_ptr<D>, bases<B> > c2;
|
||||
#line 1650 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
BOOST_MPL_ASSERT((boost::is_same<c1::class_type, B>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<c1::base_list, bases<> >));
|
||||
BOOST_MPL_ASSERT((boost::is_same<c1::held_type, B>));
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<c1::copyable, boost::noncopyable>
|
||||
));
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<c2::class_type, D>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<c2::base_list, bases<B> >));
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<c2::held_type, std::auto_ptr<D> >
|
||||
));
|
||||
BOOST_MPL_ASSERT((boost::is_same<c2::copyable, void>));
|
||||
|
||||
41
test/literate/default-expression-evaluation0.cpp
Normal file
41
test/literate/default-expression-evaluation0.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
#line 730 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
|
||||
BOOST_PARAMETER_NAME(graph)
|
||||
BOOST_PARAMETER_NAME(visitor)
|
||||
BOOST_PARAMETER_NAME(root_vertex)
|
||||
BOOST_PARAMETER_NAME(index_map)
|
||||
BOOST_PARAMETER_NAME(color_map)
|
||||
#line 702 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/graph/depth_first_search.hpp> // for dfs_visitor
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(void), depth_first_search, tag
|
||||
|
||||
, (required
|
||||
(graph, *)
|
||||
(visitor, *)
|
||||
(root_vertex, *)
|
||||
(index_map, *)
|
||||
(color_map, *)
|
||||
)
|
||||
|
||||
)
|
||||
{
|
||||
std::cout << "graph=" << graph << std::endl;
|
||||
std::cout << "visitor=" << visitor << std::endl;
|
||||
std::cout << "root_vertex=" << root_vertex << std::endl;
|
||||
std::cout << "index_map=" << index_map << std::endl;
|
||||
std::cout << "color_map=" << color_map << std::endl;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
depth_first_search(1, 2, 3, 4, 5);
|
||||
|
||||
depth_first_search(
|
||||
"1", '2', _color_map = '5',
|
||||
_index_map = "4", _root_vertex = "3");
|
||||
}
|
||||
11
test/literate/defining-the-keywords0.cpp
Normal file
11
test/literate/defining-the-keywords0.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#line 397 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter/name.hpp>
|
||||
|
||||
namespace graphs
|
||||
{
|
||||
BOOST_PARAMETER_NAME(graph) // Note: no semicolon
|
||||
BOOST_PARAMETER_NAME(visitor)
|
||||
BOOST_PARAMETER_NAME(root_vertex)
|
||||
BOOST_PARAMETER_NAME(index_map)
|
||||
BOOST_PARAMETER_NAME(color_map)
|
||||
}
|
||||
15
test/literate/defining-the-keywords1.cpp
Normal file
15
test/literate/defining-the-keywords1.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
#line 424 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter/keyword.hpp>
|
||||
#line 413 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace graphs
|
||||
{
|
||||
namespace tag { struct graph; } // keyword tag type
|
||||
|
||||
namespace // unnamed
|
||||
{
|
||||
// A reference to the keyword object
|
||||
boost::parameter::keyword<tag::graph>& _graph
|
||||
= boost::parameter::keyword<tag::graph>::get();
|
||||
}
|
||||
}
|
||||
101
test/literate/exercising-the-code-so-far0.cpp
Normal file
101
test/literate/exercising-the-code-so-far0.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
|
||||
#line 1415 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <boost/mpl/is_sequence.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
#include <memory>
|
||||
|
||||
using namespace boost::parameter;
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(class_type)
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(base_list)
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(held_type)
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(copyable)
|
||||
|
||||
template <class B = int>
|
||||
struct bases
|
||||
{};
|
||||
|
||||
}}
|
||||
#line 1402 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace boost { namespace python {
|
||||
|
||||
using boost::mpl::_;
|
||||
|
||||
typedef parameter::parameters<
|
||||
required<tag::class_type, boost::is_class<_> >
|
||||
, parameter::optional<tag::base_list, mpl::is_sequence<_> >
|
||||
, parameter::optional<tag::held_type>
|
||||
, parameter::optional<tag::copyable>
|
||||
> class_signature;
|
||||
|
||||
}}
|
||||
|
||||
#line 1454 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace boost { namespace python {
|
||||
|
||||
template <
|
||||
class A0
|
||||
, class A1 = parameter::void_
|
||||
, class A2 = parameter::void_
|
||||
, class A3 = parameter::void_
|
||||
>
|
||||
struct class_
|
||||
{
|
||||
// Create ArgumentPack
|
||||
typedef typename
|
||||
class_signature::bind<A0,A1,A2,A3>::type
|
||||
args;
|
||||
|
||||
// Extract first logical parameter.
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::class_type>::type class_type;
|
||||
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::base_list, bases<> >::type base_list;
|
||||
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::held_type, class_type>::type held_type;
|
||||
|
||||
typedef typename parameter::value_type<
|
||||
args, tag::copyable, void>::type copyable;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
|
||||
#line 1 "None"
|
||||
using boost::python::class_type;
|
||||
using boost::python::copyable;
|
||||
using boost::python::held_type;
|
||||
using boost::python::base_list;
|
||||
using boost::python::bases;
|
||||
|
||||
struct B {};
|
||||
struct D {};
|
||||
#line 1495 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
typedef boost::python::class_<
|
||||
class_type<B>, copyable<boost::noncopyable>
|
||||
> c1;
|
||||
|
||||
typedef boost::python::class_<
|
||||
D, held_type<std::auto_ptr<D> >, base_list<bases<B> >
|
||||
> c2;
|
||||
|
||||
#line 1515 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
BOOST_MPL_ASSERT((boost::is_same<c1::class_type, B>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<c1::base_list, bases<> >));
|
||||
BOOST_MPL_ASSERT((boost::is_same<c1::held_type, B>));
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<c1::copyable, boost::noncopyable>
|
||||
));
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<c2::class_type, D>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<c2::base_list, bases<B> >));
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<c2::held_type, std::auto_ptr<D> >
|
||||
));
|
||||
BOOST_MPL_ASSERT((boost::is_same<c2::copyable, void>));
|
||||
31
test/literate/extracting-parameter-types0.cpp
Normal file
31
test/literate/extracting-parameter-types0.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
#line 1830 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <cassert>
|
||||
#line 1813 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
BOOST_PARAMETER_NAME(name)
|
||||
BOOST_PARAMETER_NAME(index)
|
||||
|
||||
template <class Name, class Index>
|
||||
int deduce_arg_types_impl(Name& name, Index& index)
|
||||
{
|
||||
Name& n2 = name; // we know the types
|
||||
Index& i2 = index;
|
||||
return index;
|
||||
}
|
||||
|
||||
template <class ArgumentPack>
|
||||
int deduce_arg_types(ArgumentPack const& args)
|
||||
{
|
||||
return deduce_arg_types_impl(args[_name], args[_index|42]);
|
||||
}
|
||||
#line 1834 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
int a1 = deduce_arg_types((_name = "foo"));
|
||||
int a2 = deduce_arg_types((_name = "foo", _index = 3));
|
||||
|
||||
int main()
|
||||
{
|
||||
assert(a1 == 42);
|
||||
assert(a2 == 3);
|
||||
}
|
||||
|
||||
24
test/literate/extracting-parameter-types1.cpp
Normal file
24
test/literate/extracting-parameter-types1.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
#line 1863 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <cassert>
|
||||
|
||||
namespace parameter = boost::parameter;
|
||||
#line 1852 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
BOOST_PARAMETER_NAME(index)
|
||||
|
||||
template <class ArgumentPack>
|
||||
typename parameter::value_type<ArgumentPack, tag::index, int>::type
|
||||
twice_index(ArgumentPack const& args)
|
||||
{
|
||||
return 2 * args[_index|42];
|
||||
}
|
||||
|
||||
int six = twice_index(_index = 3);
|
||||
#line 1871 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
int main()
|
||||
{
|
||||
assert(six == 6);
|
||||
}
|
||||
|
||||
18
test/literate/fine-grained-name-control0.cpp
Normal file
18
test/literate/fine-grained-name-control0.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
#line 1703 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#line 1693 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
BOOST_PARAMETER_NAME((pass_foo, keywords) foo)
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(int), f,
|
||||
keywords, (required (foo, *)))
|
||||
{
|
||||
return foo + 1;
|
||||
}
|
||||
|
||||
int x = f(pass_foo = 41);
|
||||
#line 1704 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
int main()
|
||||
{}
|
||||
|
||||
33
test/literate/handling-out-parameters0.cpp
Normal file
33
test/literate/handling-out-parameters0.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
#line 620 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
int vertex_index = 0;
|
||||
|
||||
template <class T = int>
|
||||
struct dfs_visitor
|
||||
{};
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_NAME(graph)
|
||||
|
||||
BOOST_PARAMETER_NAME(visitor)
|
||||
BOOST_PARAMETER_NAME(root_vertex)
|
||||
BOOST_PARAMETER_NAME(index_map)
|
||||
BOOST_PARAMETER_NAME(color_map)
|
||||
|
||||
BOOST_PARAMETER_FUNCTION((void), f, tag,
|
||||
(required (graph, *))
|
||||
#line 612 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
(optional
|
||||
(visitor, *, boost::dfs_visitor<>())
|
||||
(root_vertex, *, *vertices(graph).first)
|
||||
(index_map, *, get(boost::vertex_index,graph))
|
||||
(in_out(color_map), *,
|
||||
default_color_map(num_vertices(graph), index_map) )
|
||||
)
|
||||
#line 642 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
) {}
|
||||
|
||||
5
test/literate/headers-and-namespaces0.cpp
Normal file
5
test/literate/headers-and-namespaces0.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#line 274 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter/keyword.hpp>
|
||||
#line 283 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
using boost::parameter::keyword;
|
||||
|
||||
27
test/literate/lazy-default-computation0.cpp
Normal file
27
test/literate/lazy-default-computation0.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
#line 1911 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace parameter = boost::parameter;
|
||||
#line 1894 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
BOOST_PARAMETER_NAME(s1)
|
||||
BOOST_PARAMETER_NAME(s2)
|
||||
BOOST_PARAMETER_NAME(s3)
|
||||
|
||||
template <class ArgumentPack>
|
||||
std::string f(ArgumentPack const& args)
|
||||
{
|
||||
std::string const& s1 = args[_s1];
|
||||
std::string const& s2 = args[_s2];
|
||||
typename parameter::binding<
|
||||
ArgumentPack,tag::s3,std::string
|
||||
>::type s3 = args[_s3|(s1+s2)]; // always constructs s1+s2
|
||||
return s3;
|
||||
}
|
||||
|
||||
std::string x = f((_s1="hello,", _s2=" world", _s3="hi world"));
|
||||
#line 1917 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
int main()
|
||||
{}
|
||||
|
||||
33
test/literate/lazy-default-computation1.cpp
Normal file
33
test/literate/lazy-default-computation1.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
#line 1943 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/parameter.hpp>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
|
||||
namespace parameter = boost::parameter;
|
||||
|
||||
BOOST_PARAMETER_NAME(s1)
|
||||
BOOST_PARAMETER_NAME(s2)
|
||||
BOOST_PARAMETER_NAME(s3)
|
||||
|
||||
template <class ArgumentPack>
|
||||
std::string f(ArgumentPack const& args)
|
||||
{
|
||||
std::string const& s1 = args[_s1];
|
||||
std::string const& s2 = args[_s2];
|
||||
#line 1938 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
typename parameter::binding<
|
||||
ArgumentPack, tag::s3, std::string
|
||||
>::type s3 = args[_s3
|
||||
|| boost::bind(std::plus<std::string>(), boost::ref(s1), boost::ref(s2)) ];
|
||||
#line 1962 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
return s3;
|
||||
}
|
||||
|
||||
std::string x = f((_s1="hello,", _s2=" world", _s3="hi world"));
|
||||
|
||||
int main()
|
||||
{}
|
||||
|
||||
25
test/literate/namespaces0.cpp
Normal file
25
test/literate/namespaces0.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
#line 2082 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#line 2085 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
#line 2071 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace lib
|
||||
{
|
||||
BOOST_PARAMETER_NAME(name)
|
||||
BOOST_PARAMETER_NAME(index)
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(int), f, tag,
|
||||
(optional (name,*,"bob")(index,(int),1))
|
||||
)
|
||||
{
|
||||
std::cout << name << ":" << index << std::endl;
|
||||
return index;
|
||||
}
|
||||
}
|
||||
#line 2098 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
int x = lib::f(lib::_name = "jill", lib::_index = 1);
|
||||
#line 2102 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
int main() {}
|
||||
|
||||
28
test/literate/namespaces1.cpp
Normal file
28
test/literate/namespaces1.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
#line 2100 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#line 2085 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
#line 2071 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace lib
|
||||
{
|
||||
BOOST_PARAMETER_NAME(name)
|
||||
BOOST_PARAMETER_NAME(index)
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(int), f, tag,
|
||||
(optional (name,*,"bob")(index,(int),1))
|
||||
)
|
||||
{
|
||||
std::cout << name << ":" << index << std::endl;
|
||||
return index;
|
||||
}
|
||||
}
|
||||
#line 2111 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
using lib::_name;
|
||||
using lib::_index;
|
||||
|
||||
int x = lib::f(_name = "jill", _index = 1);
|
||||
#line 2120 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
int main() {}
|
||||
|
||||
26
test/literate/namespaces2.cpp
Normal file
26
test/literate/namespaces2.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
#line 2114 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#line 2085 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
#line 2071 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace lib
|
||||
{
|
||||
BOOST_PARAMETER_NAME(name)
|
||||
BOOST_PARAMETER_NAME(index)
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(int), f, tag,
|
||||
(optional (name,*,"bob")(index,(int),1))
|
||||
)
|
||||
{
|
||||
std::cout << name << ":" << index << std::endl;
|
||||
return index;
|
||||
}
|
||||
}
|
||||
#line 2128 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
using namespace lib;
|
||||
int x = f(_name = "jill", _index = 3);
|
||||
#line 2134 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
int main() {}
|
||||
|
||||
29
test/literate/namespaces3.cpp
Normal file
29
test/literate/namespaces3.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
#line 2161 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
#line 2143 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace lib
|
||||
{
|
||||
namespace keywords
|
||||
{
|
||||
BOOST_PARAMETER_NAME(name)
|
||||
BOOST_PARAMETER_NAME(index)
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(int), f, keywords::tag,
|
||||
(optional (name,*,"bob")(index,(int),1))
|
||||
)
|
||||
{
|
||||
std::cout << name << ":" << index << std::endl;
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
#line 2170 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
using namespace lib::keywords;
|
||||
int y = lib::f(_name = "bob", _index = 2);
|
||||
#line 2172 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
int main() {}
|
||||
|
||||
31
test/literate/optional-parameters0.cpp
Normal file
31
test/literate/optional-parameters0.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
#line 571 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
int vertex_index = 0;
|
||||
|
||||
template <class T = int>
|
||||
struct dfs_visitor
|
||||
{};
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_NAME(graph)
|
||||
BOOST_PARAMETER_NAME(visitor)
|
||||
BOOST_PARAMETER_NAME(root_vertex)
|
||||
BOOST_PARAMETER_NAME(index_map)
|
||||
BOOST_PARAMETER_NAME(color_map)
|
||||
|
||||
BOOST_PARAMETER_FUNCTION((void), f, tag,
|
||||
(required (graph, *))
|
||||
#line 563 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
(optional (visitor, *, boost::dfs_visitor<>())
|
||||
(root_vertex, *, *vertices(graph).first)
|
||||
(index_map, *, get(boost::vertex_index,graph))
|
||||
(in_out(color_map), *,
|
||||
default_color_map(num_vertices(graph), index_map) )
|
||||
)
|
||||
#line 592 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
) {}
|
||||
|
||||
37
test/literate/parameter-enabled-constructors0.cpp
Normal file
37
test/literate/parameter-enabled-constructors0.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
#line 1248 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
#line 1234 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
BOOST_PARAMETER_NAME(name)
|
||||
BOOST_PARAMETER_NAME(index)
|
||||
|
||||
struct myclass_impl
|
||||
{
|
||||
template <class ArgumentPack>
|
||||
myclass_impl(ArgumentPack const& args)
|
||||
{
|
||||
std::cout << "name = " << args[_name]
|
||||
<< "; index = " << args[_index | 42]
|
||||
<< std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
#line 1261 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
struct myclass : myclass_impl
|
||||
{
|
||||
BOOST_PARAMETER_CONSTRUCTOR(
|
||||
myclass, (myclass_impl), tag
|
||||
, (required (name,*)) (optional (index,*))) // no semicolon
|
||||
};
|
||||
|
||||
|
||||
#line 1275 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
int main() {
|
||||
#line 1272 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
myclass x("bob", 3); // positional
|
||||
myclass y(_index = 12, _name = "sally"); // named
|
||||
myclass z("june"); // positional/defaulted
|
||||
#line 1275 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
}
|
||||
|
||||
17
test/literate/parameter-enabled-member-functions0.cpp
Normal file
17
test/literate/parameter-enabled-member-functions0.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
#line 1154 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
using namespace boost::parameter;
|
||||
#line 1142 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
BOOST_PARAMETER_NAME(arg1)
|
||||
BOOST_PARAMETER_NAME(arg2)
|
||||
|
||||
struct callable2
|
||||
{
|
||||
BOOST_PARAMETER_CONST_MEMBER_FUNCTION(
|
||||
(void), call, tag, (required (arg1,(int))(arg2,(int))))
|
||||
{
|
||||
std::cout << arg1 << ", " << arg2 << std::endl;
|
||||
}
|
||||
};
|
||||
18
test/literate/parameter-enabled-member-functions1.cpp
Normal file
18
test/literate/parameter-enabled-member-functions1.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
#line 1177 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
BOOST_PARAMETER_NAME(arg1)
|
||||
BOOST_PARAMETER_NAME(arg2)
|
||||
using namespace boost::parameter;
|
||||
#line 1166 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
struct callable2
|
||||
{
|
||||
BOOST_PARAMETER_CONST_MEMBER_FUNCTION(
|
||||
(void), call, tag, (required (arg1,(int))(arg2,(int))))
|
||||
{
|
||||
call_impl(arg1,arg2);
|
||||
}
|
||||
private:
|
||||
void call_impl(int, int); // implemented elsewhere.
|
||||
};
|
||||
106
test/literate/predicate-requirements0.cpp
Normal file
106
test/literate/predicate-requirements0.cpp
Normal file
@@ -0,0 +1,106 @@
|
||||
|
||||
#line 935 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/graph/depth_first_search.hpp>
|
||||
|
||||
BOOST_PARAMETER_NAME((_graph, graphs) graph)
|
||||
BOOST_PARAMETER_NAME((_visitor, graphs) visitor)
|
||||
BOOST_PARAMETER_NAME((_root_vertex, graphs) root_vertex)
|
||||
BOOST_PARAMETER_NAME((_index_map, graphs) index_map)
|
||||
BOOST_PARAMETER_NAME((_color_map, graphs) color_map)
|
||||
|
||||
using boost::mpl::_;
|
||||
#line 859 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
// We first need to define a few metafunction that we use in the
|
||||
// predicates below.
|
||||
|
||||
template <class G>
|
||||
struct traversal_category
|
||||
{
|
||||
typedef typename boost::graph_traits<G>::traversal_category type;
|
||||
};
|
||||
|
||||
template <class G>
|
||||
struct vertex_descriptor
|
||||
{
|
||||
typedef typename boost::graph_traits<G>::vertex_descriptor type;
|
||||
};
|
||||
|
||||
template <class G>
|
||||
struct value_type
|
||||
{
|
||||
typedef typename boost::property_traits<G>::value_type type;
|
||||
};
|
||||
|
||||
template <class G>
|
||||
struct key_type
|
||||
{
|
||||
typedef typename boost::property_traits<G>::key_type type;
|
||||
};
|
||||
|
||||
template<class Size, class IndexMap>
|
||||
boost::iterator_property_map<
|
||||
boost::default_color_type*, IndexMap
|
||||
, boost::default_color_type, boost::default_color_type&
|
||||
>
|
||||
default_color_map(Size num_vertices, IndexMap const& index_map)
|
||||
{
|
||||
std::vector<boost::default_color_type> colors(num_vertices);
|
||||
return &colors[0];
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(void), depth_first_search, graphs
|
||||
|
||||
, (required
|
||||
(graph
|
||||
, *(boost::mpl::and_<
|
||||
boost::is_convertible<
|
||||
traversal_category<_>, boost::incidence_graph_tag
|
||||
>
|
||||
, boost::is_convertible<
|
||||
traversal_category<_>, boost::vertex_list_graph_tag
|
||||
>
|
||||
>) ))
|
||||
|
||||
(optional
|
||||
(visitor, *, boost::dfs_visitor<>()) // not checkable
|
||||
|
||||
(root_vertex
|
||||
, (vertex_descriptor<graphs::graph::_>)
|
||||
, *vertices(graph).first)
|
||||
|
||||
(index_map
|
||||
, *(boost::mpl::and_<
|
||||
boost::is_integral<value_type<_> >
|
||||
, boost::is_same<
|
||||
vertex_descriptor<graphs::graph::_>, key_type<_>
|
||||
>
|
||||
>)
|
||||
, get(boost::vertex_index,graph))
|
||||
|
||||
(in_out(color_map)
|
||||
, *(boost::is_same<
|
||||
vertex_descriptor<graphs::graph::_>, key_type<_>
|
||||
>)
|
||||
, default_color_map(num_vertices(graph), index_map) )
|
||||
)
|
||||
)
|
||||
#line 949 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
{}
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> G;
|
||||
|
||||
enum {u, v, w, x, y, z, N};
|
||||
typedef std::pair<int, int> E;
|
||||
E edges[] = {E(u, v), E(u, x), E(x, v), E(y, x), E(v, y), E(w, y),
|
||||
E(w,z), E(z, z)};
|
||||
G g(edges, edges + sizeof(edges) / sizeof(E), N);
|
||||
|
||||
depth_first_search(g);
|
||||
depth_first_search(g, _root_vertex = (int)x);
|
||||
}
|
||||
|
||||
12
test/literate/required-parameters0.cpp
Normal file
12
test/literate/required-parameters0.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
#line 540 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
BOOST_PARAMETER_NAME(graph)
|
||||
|
||||
BOOST_PARAMETER_FUNCTION((void), f, tag,
|
||||
#line 531 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
(required (graph, *) )
|
||||
#line 547 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
) {}
|
||||
|
||||
16
test/literate/static-member-functions0.cpp
Normal file
16
test/literate/static-member-functions0.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
#line 1206 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
using namespace boost::parameter;
|
||||
#line 1195 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
BOOST_PARAMETER_NAME(arg1)
|
||||
|
||||
struct somebody
|
||||
{
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION(
|
||||
(void), static f, tag, (optional (arg1,(int),0)))
|
||||
{
|
||||
std::cout << arg1 << std::endl;
|
||||
}
|
||||
};
|
||||
12
test/literate/template-keywords0.cpp
Normal file
12
test/literate/template-keywords0.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
#line 1337 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#line 1329 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace boost { namespace python {
|
||||
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(class_type)
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(base_list)
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(held_type)
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(copyable)
|
||||
|
||||
}}
|
||||
13
test/literate/template-keywords1.cpp
Normal file
13
test/literate/template-keywords1.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
#line 1353 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
#line 1344 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
namespace boost { namespace python {
|
||||
|
||||
namespace tag { struct class_type; } // keyword tag type
|
||||
template <class T>
|
||||
struct class_type
|
||||
: parameter::template_keyword<tag::class_type,T>
|
||||
{};
|
||||
|
||||
}}
|
||||
40
test/literate/top-level0.cpp
Normal file
40
test/literate/top-level0.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
#line 35 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
namespace test
|
||||
{
|
||||
BOOST_PARAMETER_NAME(title)
|
||||
BOOST_PARAMETER_NAME(width)
|
||||
BOOST_PARAMETER_NAME(titlebar)
|
||||
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(int), new_window, tag, (required (title,*)(width,*)(titlebar,*)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(deleter)
|
||||
BOOST_PARAMETER_TEMPLATE_KEYWORD(copy_policy)
|
||||
|
||||
template <class T> struct Deallocate {};
|
||||
struct DeepCopy {};
|
||||
|
||||
namespace parameter = boost::parameter;
|
||||
|
||||
struct Foo {};
|
||||
template <class T, class A0, class A1>
|
||||
struct smart_ptr
|
||||
{
|
||||
smart_ptr(Foo*);
|
||||
};
|
||||
}
|
||||
using namespace test;
|
||||
int x =
|
||||
#line 19
|
||||
new_window("alert", _width=10, _titlebar=false);
|
||||
|
||||
smart_ptr<
|
||||
Foo
|
||||
, deleter<Deallocate<Foo> >
|
||||
, copy_policy<DeepCopy> > p(new Foo);
|
||||
45
test/literate/writing-the-function0.cpp
Normal file
45
test/literate/writing-the-function0.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
#line 472 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter/name.hpp>
|
||||
|
||||
BOOST_PARAMETER_NAME(graph)
|
||||
BOOST_PARAMETER_NAME(visitor)
|
||||
BOOST_PARAMETER_NAME(root_vertex)
|
||||
BOOST_PARAMETER_NAME(index_map)
|
||||
BOOST_PARAMETER_NAME(color_map)
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class T = int>
|
||||
struct dfs_visitor
|
||||
{};
|
||||
|
||||
int vertex_index = 0;
|
||||
|
||||
}
|
||||
#line 446 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
|
||||
#include <boost/parameter/preprocessor.hpp>
|
||||
|
||||
namespace graphs
|
||||
{
|
||||
BOOST_PARAMETER_FUNCTION(
|
||||
(void), // 1. parenthesized return type
|
||||
depth_first_search, // 2. name of the function template
|
||||
|
||||
tag, // 3. namespace of tag types
|
||||
|
||||
(required (graph, *) ) // 4. one required parameter, and
|
||||
|
||||
(optional // four optional parameters, with defaults
|
||||
(visitor, *, boost::dfs_visitor<>())
|
||||
(root_vertex, *, *vertices(graph).first)
|
||||
(index_map, *, get(boost::vertex_index,graph))
|
||||
(in_out(color_map), *,
|
||||
default_color_map(num_vertices(graph), index_map) )
|
||||
)
|
||||
)
|
||||
{
|
||||
// ... body of function goes here...
|
||||
// use graph, visitor, index_map, and color_map
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user