Skip to content

Commit 6b5ea67

Browse files
committed
doc update
[SVN r15559]
1 parent d873aec commit 6b5ea67

2 files changed

Lines changed: 127 additions & 87 deletions

File tree

‎doc/v2/make_function.html‎

Lines changed: 86 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,150 @@
11
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2-
<meta name="generator" content="HTML Tidy, see www.w3.org">
2+
3+
<html>
4+
<head>
5+
<meta name="generator" content=
6+
"HTML Tidy for Windows (vers 1st August 2002), see www.w3.org">
37
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
48
<link rel="stylesheet" type="text/css" href="../boost.css">
59

610
<title>Boost.Python - &lt;boost/python/make_function.hpp&gt;</title>
11+
</head>
712

13+
<body>
814
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
915
"header">
1016
<tr>
1117
<td valign="top" width="300">
12-
<h3><a href="../../../../index.htm"><img height="86" width="277" alt=
13-
"C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
18+
<h3><a href="../../../../index.htm"><img height="86" width="277"
19+
alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
20+
</td>
1421

1522
<td valign="top">
1623
<h1 align="center">Boost.Python</h1>
1724

18-
<h2 align="center">Header &lt;boost/python/make_function.hpp&gt;</h2>
25+
<h2 align="center">Header
26+
&lt;boost/python/make_function.hpp&gt;</h2>
27+
</td>
28+
</tr>
1929
</table>
2030
<hr>
2131

2232
<h2>Contents</h2>
2333

2434
<dl class="page-index">
25-
<dt><a href="#introduction">Introduction</a>
35+
<dt><a href="#introduction">Introduction</a></dt>
2636

27-
<dt><a href="#functions">Functions</a>
37+
<dt><a href="#functions">Functions</a></dt>
2838

2939
<dd>
3040
<dl class="page-index">
31-
<dt><a href="#make_function-spec">make_function</a>
41+
<dt><a href="#make_function-spec">make_function</a></dt>
3242

33-
<dt><a href="#make_constructor-spec">make_constructor</a>
43+
<dt><a href="#make_constructor-spec">make_constructor</a></dt>
3444
</dl>
45+
</dd>
3546

36-
<dt><a href="#examples">Example</a>
47+
<dt><a href="#examples">Example</a></dt>
3748
</dl>
3849
<hr>
3950

4051
<h2><a name="introduction"></a>Introduction</h2>
4152

4253
<p><code><a href="#make_function-spec">make_function</a>()</code> and
4354
<code><a href="#make_constructor-spec">make_constructor</a>()</code> are
44-
the functions used internally by <code>class_&lt;&gt;::<a href=
45-
"class.html#class_-spec-modifiers">def</a></code>, <code>class_&lt;&gt;::<a
46-
href="module.html#module-spec-modifiers">def</a></code>, and
47-
<code>class_&lt;&gt;::<a href=
48-
"class.html#class_-spec-modifiers">def_init</a></code> to produce Python
49-
callable objects which wrap C++ functions and member functions.
55+
the functions used internally by <code><a href=
56+
"def.html#def-spec">def</a>()</code> and <code>class_&lt;&gt;::<a href=
57+
"class.html#class_-spec-modifiers">def</a>()</code> to produce Python
58+
callable objects which wrap C++ functions and member functions.</p>
5059

5160
<h2><a name="functions"></a>Functions</h2>
5261
<pre>
5362
<a name="make_function-spec">template &lt;class F&gt;</a>
54-
objects::function* make_function(F f)
63+
<a href="object.html#object-spec">object</a> make_function(F f)
5564

5665
template &lt;class F, class Policies&gt;
57-
objects::function* make_function(F f, Policies const&amp; policies)
66+
<a href=
67+
"object.html#object-spec">object</a> make_function(F f, Policies const&amp; policies)
68+
69+
template &lt;class F, class Policies, class Keywords&gt;
70+
<a href=
71+
"object.html#object-spec">object</a> make_function(F f, Policies const&amp; policies, Keywords const&amp; keywords)
5872
</pre>
5973

6074
<dl class="function-semantics">
6175
<dt><b>Requires:</b> <code>F</code> is a function pointer or member
62-
function pointer type
76+
function pointer type. If <code>policies</code> are supplied, it must
77+
be a model of <a href="CallPolicies.html">CallPolicies</a>. If
78+
<code>kewords</code> are supplied, it must be the result of a <a href=
79+
"args.html#keyword-expression"><em>keyword-expression</em></a>
80+
specifying no more arguments than the <a href=
81+
"definitions.html#arity">arity</a> of <code>f</code>.</dt>
6382

6483
<dt><b>Effects:</b> Creates a Python callable object which, when called
6584
from Python, converts its arguments to C++ and calls <code>f</code>. If
66-
<code>F</code> is a pointer-to-member-function type, the target object of
67-
the function call (<code>*this</code>) will be taken from the first
85+
<code>F</code> is a pointer-to-member-function type, the target object
86+
of the function call (<code>*this</code>) will be taken from the first
6887
Python argument, and subsequent Python arguments will be used as the
6988
arguments to <code>f</code>. If <code>policies</code> are supplied, it
70-
must be a model of <a href="CallPolicies.html">CallPolicies</a>, and will
71-
be applied to the function as described <a href=
72-
"CallPolicies.html">here</a>.
73-
74-
<dt><b>Returns:</b> A pointer convertible to <code>PyObject*</code> which
75-
refers to the new Python callable object.
89+
will be applied to the function as described <a href=
90+
"CallPolicies.html">here</a>. If <code>keywords</code> are
91+
supplied, the keywords will be applied in order to the final
92+
arguments of the resulting function.</dt>
93+
94+
<dt><b>Returns:</b> An instance of <a href=
95+
"object.html#object-spec">object</a> which holds the new Python
96+
callable object.</dt>
7697
</dl>
7798
<pre>
7899
<a name=
79-
"make_constructor-spec">template &lt;class T, class ArgList, class Generator&gt;
80-
objects::function* make_constructor();</a>
81-
100+
"make_constructor-spec"></a>template &lt;class T, class ArgList, class Generator&gt;
101+
<a href="object.html#object-spec">object</a> make_constructor();
102+
82103
template &lt;class ArgList, class Generator, class Policies&gt;
83-
objects::function* make_constructor(Policies const&amp; policies)
104+
<a href=
105+
"object.html#object-spec">object</a> make_constructor(Policies const&amp; policies)
84106
</pre>
85107

86108
<dl class="function-semantics">
87-
<dt><b>Requires:</b> <code>T</code> is a class
88-
type. <code>Policies</code> is a model of <a
89-
href="CallPolicies.html">CallPolicies</a>. <code>ArgList</code>
90-
is an <a href="../../../mpl/doc/Sequences.html">MPL sequence</a>
91-
of C++ argument types (<i>A1, A2,... AN</i>) such that if
92-
<code>a1, a2</code>... <code>aN</code> are objects of type
93-
<i>A1, A2,... AN</i> respectively, the expression <code>new
94-
Generator::apply&lt;T&gt;::type(a1, a2</code>... <code>aN</code>) is
95-
valid. Generator is a model of <a href=
96-
"HolderGenerator.html">HolderGenerator</a>.
109+
<dt><b>Requires:</b> <code>T</code> is a class type.
110+
<code>Policies</code> is a model of <a href=
111+
"CallPolicies.html">CallPolicies</a>. <code>ArgList</code> is an <a
112+
href="../../../mpl/doc/Sequences.html">MPL sequence</a> of C++ argument
113+
types (<i>A1,&nbsp;A2,...&nbsp;AN</i>) such that if
114+
<code>a1,&nbsp;a2</code>...&nbsp;<code>aN</code> are objects of type
115+
<i>A1,&nbsp;A2,...&nbsp;AN</i> respectively, the expression <code>new
116+
Generator::apply&lt;T&gt;::type(a1,&nbsp;a2</code>...&nbsp;<code>aN</code>)
117+
is valid. Generator is a model of <a href=
118+
"HolderGenerator.html">HolderGenerator</a>.</dt>
97119

98120
<dt><b>Effects:</b> Creates a Python callable object which, when called
99121
from Python, expects its first argument to be a Boost.Python extension
100122
class object. It converts its remaining its arguments to C++ and passes
101123
them to the constructor of a dynamically-allocated
102-
<code>Generator::apply&lt;T&gt;::type</code> object, which is
103-
then installed in the extension class object. In the second
104-
form, the <code>policies</code> are applied to the arguments and
105-
result (<a
106-
href="http://www.python.org/doc/current/lib/bltin-null-object.html">None</a>)
107-
of the Python callable object
108-
109-
<dt><b>Returns:</b> The new Python callable object
124+
<code>Generator::apply&lt;T&gt;::type</code> object, which is then
125+
installed in the extension class object. In the second form, the
126+
<code>policies</code> are applied to the arguments and result (<a href=
127+
"http://www.python.org/doc/current/lib/bltin-null-object.html">None</a>)
128+
of the Python callable object</dt>
129+
130+
<dt><b>Returns:</b> An instance of <a href=
131+
"object.html#object-spec">object</a> which holds the new Python
132+
callable object.</dt>
110133
</dl>
111134

112135
<h2><a name="examples"></a>Example</h2>
113136

114-
<p>C++ function exposed below returns a callable object wrapping one of two
115-
functions.
137+
<p>C++ function exposed below returns a callable object wrapping one of
138+
two functions.</p>
116139
<pre>
117140
#include &lt;boost/python/make_function.hpp&gt;
118-
#include &lt;boost/python/module.hpp&gt;
141+
#include &lt;boost/python/module_init.hpp&gt;
119142

120143
char const* foo() { return "foo"; }
121144
char const* bar() { return "bar"; }
122145

123-
PyObject* choose_function(bool selector)
146+
using namespace boost::python;
147+
object choose_function(bool selector)
124148
{
125149
if (selector)
126150
return boost::python::make_function(foo);
@@ -130,8 +154,7 @@ <h2><a name="examples"></a>Example</h2>
130154

131155
BOOST_PYTHON_MODULE_INIT(make_function_test)
132156
{
133-
module("make_function_test")
134-
.def("choose_function", choose_function);
157+
def("choose_function", choose_function);
135158
}
136159
</pre>
137160
It can be used this way in Python:
@@ -147,9 +170,13 @@ <h2><a name="examples"></a>Example</h2>
147170

148171
<p>
149172
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
150-
14 February 2002 <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
151-
152-
153-
<p><i>&copy; Copyright <a href="../../../../people/dave_abrahams.htm">Dave
154-
Abrahams</a> 2002. All Rights Reserved.</i>
173+
29 September 2002
174+
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
175+
</p>
176+
177+
<p><i>&copy; Copyright <a href=
178+
"../../../../people/dave_abrahams.htm">Dave Abrahams</a> 2002. All Rights
179+
Reserved.</i></p>
180+
</body>
181+
</html>
155182

‎doc/v2/manage_new_object.html‎

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,57 @@
11
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2-
<meta name="generator" content="HTML Tidy, see www.w3.org">
2+
3+
<html>
4+
<head>
5+
<meta name="generator" content=
6+
"HTML Tidy for Windows (vers 1st August 2002), see www.w3.org">
37
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
48
<link rel="stylesheet" type="text/css" href="../boost.css">
59

610
<title>Boost.Python - &lt;boost/python/manage_new_object.hpp&gt;</title>
11+
</head>
712

13+
<body>
814
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
915
"header">
1016
<tr>
1117
<td valign="top" width="300">
12-
<h3><a href="../../../../index.htm"><img height="86" width="277" alt=
13-
"C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
18+
<h3><a href="../../../../index.htm"><img height="86" width="277"
19+
alt="C++ Boost" src="../../../../c++boost.gif" border="0"></a></h3>
20+
</td>
1421

1522
<td valign="top">
1623
<h1 align="center">Boost.Python</h1>
1724

1825
<h2 align="center">Header
1926
&lt;boost/python/manage_new_object.hpp&gt;</h2>
27+
</td>
28+
</tr>
2029
</table>
2130
<hr>
2231

2332
<h2>Contents</h2>
2433

2534
<dl class="page-index">
26-
<dt><a href="#classes">Classes</a>
35+
<dt><a href="#classes">Classes</a></dt>
2736

2837
<dd>
2938
<dl class="page-index">
3039
<dt><a href="#manage_new_object-spec">Class
31-
<code>manage_new_object</code></a>
40+
<code>manage_new_object</code></a></dt>
3241

3342
<dd>
3443
<dl class="page-index">
3544
<dt><a href="#manage_new_object-spec-synopsis">Class
36-
<code>manage_new_object</code> synopsis</a>
45+
<code>manage_new_object</code> synopsis</a></dt>
3746

3847
<dt><a href="#manage_new_object-spec-metafunctions">Class
39-
<code>manage_new_object</code> metafunctions</a>
48+
<code>manage_new_object</code> metafunctions</a></dt>
4049
</dl>
50+
</dd>
4151
</dl>
52+
</dd>
4253

43-
<dt><a href="#examples">Example</a>
54+
<dt><a href="#examples">Example</a></dt>
4455
</dl>
4556
<hr>
4657

@@ -50,10 +61,10 @@ <h3><a name="manage_new_object-spec"></a>Class
5061
<code>manage_new_object</code></h3>
5162

5263
<p><code>manage_new_object</code> is a model of <a href=
53-
"ResultConverter.html#ResultConverterGenerator-concept">ResultConverterGenerator</a> which can be
54-
used to wrap C++ functions which return a pointer to an object allocated
55-
with a <i>new-expression</i>, and expect the caller to take responsibility
56-
for deleting that object.
64+
"ResultConverter.html#ResultConverterGenerator-concept">ResultConverterGenerator</a>
65+
which can be used to wrap C++ functions which return a pointer to an
66+
object allocated with a <i>new-expression</i>, and expect the caller to
67+
take responsibility for deleting that object.</p>
5768

5869
<h4><a name="manage_new_object-spec-synopsis"></a>Class
5970
<code>manage_new_object</code> synopsis</h4>
@@ -75,18 +86,18 @@ <h4><a name="manage_new_object-spec-metafunctions"></a>Class
7586

7687
<dl class="metafunction-semantics">
7788
<dt><b>Requires:</b> <code>T</code> is <code>U*</code> for some
78-
<code>U</code>.
89+
<code>U</code>.</dt>
7990

8091
<dt><b>Returns:</b> <code>typedef <a href=
8192
"to_python_indirect.html#to_python_indirect-spec">to_python_indirect</a>&lt;T&gt;
82-
type;</code>
93+
type;</code></dt>
8394
</dl>
8495

8596
<h2><a name="examples"></a>Example</h2>
8697

87-
<p>In C++:
98+
<p>In C++:</p>
8899
<pre>
89-
#include &lt;boost/python/module.hpp&gt;
100+
#include &lt;boost/python/module_init.hpp&gt;
90101
#include &lt;boost/python/class.hpp&gt;
91102
#include &lt;boost/python/manage_new_object.hpp&gt;
92103
#include &lt;boost/python/return_value_policy.hpp&gt;
@@ -104,15 +115,13 @@ <h2><a name="examples"></a>Example</h2>
104115
using namespace boost::python;
105116
BOOST_PYTHON_MODULE_INIT(my_module)
106117
{
107-
module("my_module")
108-
.def("make_foo", make_foo, return_value_policy&lt;manage_new_object&gt;)
109-
.add(
110-
class_&lt;Foo&gt;()
111-
.def("get_x", &amp;Foo::get_x)
112-
)
118+
def("make_foo", make_foo, return_value_policy&lt;manage_new_object&gt;())
119+
class_&lt;Foo&gt;()
120+
.def("get_x", &amp;Foo::get_x)
121+
;
113122
}
114123
</pre>
115-
In Python:
124+
In Python:
116125
<pre>
117126
&gt;&gt;&gt; from my_module import *
118127
&gt;&gt;&gt; f = make_foo(3) # create a Foo object
@@ -122,9 +131,13 @@ <h2><a name="examples"></a>Example</h2>
122131

123132
<p>Revised
124133
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
125-
14 February 2002 <!--webbot bot="Timestamp" endspan i-checksum="39359" -->
126-
127-
128-
<p><i>&copy; Copyright <a href="../../../../people/dave_abrahams.htm">Dave
129-
Abrahams</a> 2002. All Rights Reserved.</i>
134+
29 September 2002
135+
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
136+
</p>
137+
138+
<p><i>&copy; Copyright <a href=
139+
"../../../../people/dave_abrahams.htm">Dave Abrahams</a> 2002. All Rights
140+
Reserved.</i></p>
141+
</body>
142+
</html>
130143

0 commit comments

Comments
 (0)