diff options
Diffstat (limited to 'libs/python/doc')
-rw-r--r-- | libs/python/doc/tutorial/doc/html/python/functions.html | 4 | ||||
-rw-r--r-- | libs/python/doc/tutorial/doc/tutorial.qbk | 4 | ||||
-rw-r--r-- | libs/python/doc/v2/make_function.html | 51 |
3 files changed, 28 insertions, 31 deletions
diff --git a/libs/python/doc/tutorial/doc/html/python/functions.html b/libs/python/doc/tutorial/doc/html/python/functions.html index ca869d1837..ddd5bc7b70 100644 --- a/libs/python/doc/tutorial/doc/html/python/functions.html +++ b/libs/python/doc/tutorial/doc/html/python/functions.html @@ -372,8 +372,8 @@ Namespaces are one honking great idea -- let's do more of those! or writing thin wrappers: </p> <pre class="programlisting"><span class="comment">// write "thin wrappers"</span> -<span class="keyword">int</span> <span class="identifier">f1</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">x</span><span class="special">);</span> <span class="special">}</span> -<span class="keyword">int</span> <span class="identifier">f2</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">double</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span><span class="identifier">y</span><span class="special">);</span> <span class="special">}</span> +<span class="keyword">int</span> <span class="identifier">f1</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">x</span><span class="special">);</span> <span class="special">}</span> +<span class="keyword">int</span> <span class="identifier">f2</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">double</span> <span class="identifier">y</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span><span class="identifier">y</span><span class="special">);</span> <span class="special">}</span> <span class="comment">/*...*/</span> diff --git a/libs/python/doc/tutorial/doc/tutorial.qbk b/libs/python/doc/tutorial/doc/tutorial.qbk index 204c500449..10a452200c 100644 --- a/libs/python/doc/tutorial/doc/tutorial.qbk +++ b/libs/python/doc/tutorial/doc/tutorial.qbk @@ -901,8 +901,8 @@ wrapping as outlined in the [link python.overloading previous section], or writing thin wrappers: // write "thin wrappers" - int f1(int x) { f(x); } - int f2(int x, double y) { f(x,y); } + int f1(int x) { return f(x); } + int f2(int x, double y) { return f(x,y); } /*...*/ diff --git a/libs/python/doc/v2/make_function.html b/libs/python/doc/v2/make_function.html index 3913672195..d5a6cdb06e 100644 --- a/libs/python/doc/v2/make_function.html +++ b/libs/python/doc/v2/make_function.html @@ -96,10 +96,10 @@ template <class F, class Policies, class Keywords, class Signature> to <code>f</code>. <ul> <li> If <code>policies</code> are supplied, it will be applied to the function as described <a href= - "CallPolicies.html">here</a>. + "CallPolicies.html">here</a>. <li>If <code>keywords</code> are supplied, the keywords will be applied in order to the final - arguments of the resulting function. + arguments of the resulting function. <li>If <code>Signature</code> is supplied, it should be an instance of an <a href="../../../mpl/doc/refmanual/front-extensible-sequence.html">MPL front-extensible @@ -125,36 +125,33 @@ template <class F, class Policies, class Keywords, class Signature> </dl> <pre> -<a name= -"make_constructor-spec"></a>template <class T, class ArgList, class Generator> -<a href="object.html#object-spec">object</a> make_constructor(); - -template <class ArgList, class Generator, class Policies> +<a name="make_constructor-spec">template <class F></a> +<a href="object.html#object-spec">object</a> make_constructor(F f) + +template <class F, class Policies> +<a href= +"object.html#object-spec">object</a> make_constructor(F f, Policies const& policies) + +template <class F, class Policies, class KeywordsOrSignature> +<a href= +"object.html#object-spec">object</a> make_constructor(F f, Policies const& policies, KeywordsOrSignature const& ks) + +template <class F, class Policies, class Keywords, class Signature> <a href= -"object.html#object-spec">object</a> make_constructor(Policies const& policies) +"object.html#object-spec">object</a> make_constructor(F f, Policies const& policies, Keywords const& kw, Signature const& sig) </pre> <dl class="function-semantics"> - <dt><b>Requires:</b> <code>T</code> is a class type. - <code>Policies</code> is a model of <a href= - "CallPolicies.html">CallPolicies</a>. <code>ArgList</code> is an <a - href="../../../mpl/doc/refmanual/forward-sequence.html">MPL sequence</a> of C++ argument - types (<i>A1, A2,... AN</i>) such that if - <code>a1, a2</code>... <code>aN</code> are objects of type - <i>A1, A2,... AN</i> respectively, the expression <code>new - Generator::apply<T>::type(a1, a2</code>... <code>aN</code>) - is valid. Generator is a model of <a href= - "HolderGenerator.html">HolderGenerator</a>.</dt> + <dt><b>Requires:</b> <code>F</code> is a + function pointer type. If <code>policies</code> are supplied, it must + be a model of <a href="CallPolicies.html">CallPolicies</a>. If + <code>kewords</code> are supplied, it must be the result of a <a href= + "args.html#keyword-expression"><em>keyword-expression</em></a> + specifying no more arguments than the <a href= + "definitions.html#arity">arity</a> of <code>f</code>.</dt> <dt><b>Effects:</b> Creates a Python callable object which, when called - from Python, expects its first argument to be a Boost.Python extension - class object. It converts its remaining its arguments to C++ and passes - them to the constructor of a dynamically-allocated - <code>Generator::apply<T>::type</code> object, which is then - installed in the extension class object. In the second form, the - <code>policies</code> are applied to the arguments and result (<a href= - "http://www.python.org/doc/current/lib/bltin-null-object.html">None</a>) - of the Python callable object</dt> + from Python, converts its arguments to C++ and calls <code>f</code>.</dt> <dt><b>Returns:</b> An instance of <a href= "object.html#object-spec">object</a> which holds the new Python @@ -186,7 +183,7 @@ BOOST_PYTHON_MODULE(make_function_test) def("choose_function", choose_function); } </pre> - It can be used this way in Python: + It can be used this way in Python: <pre> >>> from make_function_test import * >>> f = choose_function(1) |