function_invocation_and_creation.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Chapter&#160;4.&#160;Function Invocation and Creation</title>
  5. <link rel="stylesheet" href="../boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
  7. <link rel="home" href="index.html" title="Boost.Python Reference Manual">
  8. <link rel="up" href="index.html" title="Boost.Python Reference Manual">
  9. <link rel="prev" href="object_wrappers/boost_python_tuple_hpp.html" title="boost/python/tuple.hpp">
  10. <link rel="next" href="function_invocation_and_creation/boost_python_call_hpp.html" title="boost/python/call.hpp">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr><td valign="top"><img alt="" width="" height="" src="../images/boost.png"></td></tr></table>
  14. <hr>
  15. <div class="spirit-nav">
  16. <a accesskey="p" href="object_wrappers/boost_python_tuple_hpp.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="function_invocation_and_creation/boost_python_call_hpp.html"><img src="../images/next.png" alt="Next"></a>
  17. </div>
  18. <div class="chapter">
  19. <div class="titlepage"><div><div><h1 class="title">
  20. <a name="function_invocation_and_creation"></a>Chapter&#160;4.&#160;Function Invocation and Creation</h1></div></div></div>
  21. <div class="toc">
  22. <p><b>Table of Contents</b></p>
  23. <dl class="toc">
  24. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp">boost/python/args.hpp</a></span></dt>
  25. <dd><dl>
  26. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.introduction">Introduction</a></span></dt>
  27. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.class_arg">Class
  28. <code class="computeroutput"><span class="identifier">arg</span></code></a></span></dt>
  29. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.class_arg_constructor">Class
  30. <code class="computeroutput"><span class="identifier">arg</span></code> constructor</a></span></dt>
  31. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.class_arg_operator">Class
  32. <code class="computeroutput"><span class="identifier">arg</span></code> operator=</a></span></dt>
  33. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.keyword_expression_operator">Keyword-expression
  34. operator,</a></span></dt>
  35. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.example">Example</a></span></dt>
  36. </dl></dd>
  37. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_call_hpp.html">boost/python/call.hpp</a></span></dt>
  38. <dd><dl>
  39. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_call_hpp.html#function_invocation_and_creation.boost_python_call_hpp.introduction">Introduction</a></span></dt>
  40. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_call_hpp.html#function_invocation_and_creation.boost_python_call_hpp.function_call">Function
  41. <code class="computeroutput"><span class="identifier">call</span></code></a></span></dt>
  42. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_call_hpp.html#function_invocation_and_creation.boost_python_call_hpp.example">Example</a></span></dt>
  43. </dl></dd>
  44. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_call_method_hpp.html">boost/python/call_method.hpp</a></span></dt>
  45. <dd><dl>
  46. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_call_method_hpp.html#function_invocation_and_creation.boost_python_call_method_hpp.introduction">Introduction</a></span></dt>
  47. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_call_method_hpp.html#function_invocation_and_creation.boost_python_call_method_hpp.function_call_method">Function
  48. <code class="computeroutput"><span class="identifier">call_method</span></code></a></span></dt>
  49. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_call_method_hpp.html#function_invocation_and_creation.boost_python_call_method_hpp.example">Example</a></span></dt>
  50. </dl></dd>
  51. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_data_members_hpp.html">boost/python/data_members.hpp</a></span></dt>
  52. <dd><dl>
  53. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_data_members_hpp.html#function_invocation_and_creation.boost_python_data_members_hpp.introduction">Introduction</a></span></dt>
  54. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_data_members_hpp.html#function_invocation_and_creation.boost_python_data_members_hpp.functions">Functions</a></span></dt>
  55. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_data_members_hpp.html#function_invocation_and_creation.boost_python_data_members_hpp.example">Example</a></span></dt>
  56. </dl></dd>
  57. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_make_function_hpp.html">boost/python/make_function.hpp</a></span></dt>
  58. <dd><dl>
  59. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_make_function_hpp.html#function_invocation_and_creation.boost_python_make_function_hpp.introduction">Introduction</a></span></dt>
  60. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_make_function_hpp.html#function_invocation_and_creation.boost_python_make_function_hpp.functions">Functions</a></span></dt>
  61. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_make_function_hpp.html#function_invocation_and_creation.boost_python_make_function_hpp.example">Example</a></span></dt>
  62. </dl></dd>
  63. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_overloads_hpp.html">boost/python/overloads.hpp</a></span></dt>
  64. <dd><dl>
  65. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_overloads_hpp.html#function_invocation_and_creation.boost_python_overloads_hpp.introduction">Introduction</a></span></dt>
  66. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_overloads_hpp.html#function_invocation_and_creation.boost_python_overloads_hpp.overloaddispatcher_concept">OverloadDispatcher
  67. Concept</a></span></dt>
  68. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_overloads_hpp.html#function_invocation_and_creation.boost_python_overloads_hpp.macros">Macros</a></span></dt>
  69. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_overloads_hpp.html#function_invocation_and_creation.boost_python_overloads_hpp.example">Example</a></span></dt>
  70. </dl></dd>
  71. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_ptr_hpp.html">boost/python/ptr.hpp</a></span></dt>
  72. <dd><dl>
  73. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_ptr_hpp.html#function_invocation_and_creation.boost_python_ptr_hpp.introduction">Introduction</a></span></dt>
  74. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_ptr_hpp.html#function_invocation_and_creation.boost_python_ptr_hpp.functions">Functions</a></span></dt>
  75. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_ptr_hpp.html#function_invocation_and_creation.boost_python_ptr_hpp.class_template_pointer_wrapper">Class
  76. template <code class="computeroutput"><span class="identifier">pointer_wrapper</span></code></a></span></dt>
  77. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_ptr_hpp.html#function_invocation_and_creation.boost_python_ptr_hpp.class_template_pointer_wrapper_t">Class
  78. template <code class="computeroutput"><span class="identifier">pointer_wrapper</span></code>
  79. types</a></span></dt>
  80. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_ptr_hpp.html#function_invocation_and_creation.boost_python_ptr_hpp.class_template_pointer_wrapper_c">Class
  81. template <code class="computeroutput"><span class="identifier">pointer_wrapper</span></code>
  82. constructors and destructor</a></span></dt>
  83. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_ptr_hpp.html#function_invocation_and_creation.boost_python_ptr_hpp.class_template_pointer_wrapper_o">Class
  84. template <code class="computeroutput"><span class="identifier">pointer_wrapper</span></code>
  85. observer functions</a></span></dt>
  86. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_ptr_hpp.html#function_invocation_and_creation.boost_python_ptr_hpp.metafunctions">Metafunctions</a></span></dt>
  87. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_ptr_hpp.html#function_invocation_and_creation.boost_python_ptr_hpp.example">Example</a></span></dt>
  88. </dl></dd>
  89. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_raw_function_hpp.html">boost/python/raw_function.hpp</a></span></dt>
  90. <dd><dl>
  91. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_raw_function_hpp.html#function_invocation_and_creation.boost_python_raw_function_hpp.introduction">Introduction</a></span></dt>
  92. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_raw_function_hpp.html#function_invocation_and_creation.boost_python_raw_function_hpp.function_raw_function">Function
  93. <code class="computeroutput"><span class="identifier">raw_function</span></code></a></span></dt>
  94. <dt><span class="section"><a href="function_invocation_and_creation/boost_python_raw_function_hpp.html#function_invocation_and_creation.boost_python_raw_function_hpp.example">Example</a></span></dt>
  95. </dl></dd>
  96. <dt><span class="section"><a href="function_invocation_and_creation/function_documentation.html">Function
  97. documentation</a></span></dt>
  98. <dd><dl>
  99. <dt><span class="section"><a href="function_invocation_and_creation/function_documentation.html#function_invocation_and_creation.function_documentation.boost_python_function_doc_signat">boost/python/function_doc_signature.hpp</a></span></dt>
  100. <dt><span class="section"><a href="function_invocation_and_creation/function_documentation.html#function_invocation_and_creation.function_documentation.boost_python_pytype_function_hpp">boost/python/pytype_function.hpp</a></span></dt>
  101. </dl></dd>
  102. <dt><span class="section"><a href="function_invocation_and_creation/models_of_callpolicies.html">Models
  103. of CallPolicies</a></span></dt>
  104. <dd><dl>
  105. <dt><span class="section"><a href="function_invocation_and_creation/models_of_callpolicies.html#function_invocation_and_creation.models_of_callpolicies.boost_python_default_call_polici">boost/python/default_call_policies.hpp</a></span></dt>
  106. <dt><span class="section"><a href="function_invocation_and_creation/models_of_callpolicies.html#function_invocation_and_creation.models_of_callpolicies.boost_python_return_arg_hpp">boost/python/return_arg.hpp</a></span></dt>
  107. <dt><span class="section"><a href="function_invocation_and_creation/models_of_callpolicies.html#function_invocation_and_creation.models_of_callpolicies.boost_python_return_internal_ref">boost/python/return_internal_reference.hpp</a></span></dt>
  108. <dt><span class="section"><a href="function_invocation_and_creation/models_of_callpolicies.html#function_invocation_and_creation.models_of_callpolicies.boost_python_return_value_policy">boost/python/return_value_policy.hpp</a></span></dt>
  109. <dt><span class="section"><a href="function_invocation_and_creation/models_of_callpolicies.html#function_invocation_and_creation.models_of_callpolicies.boost_python_with_custodian_and_">boost/python/with_custodian_and_ward.hpp</a></span></dt>
  110. </dl></dd>
  111. <dt><span class="section"><a href="function_invocation_and_creation/models_of_resultconverter.html">Models
  112. of ResultConverter</a></span></dt>
  113. <dd><dl>
  114. <dt><span class="section"><a href="function_invocation_and_creation/models_of_resultconverter.html#function_invocation_and_creation.models_of_resultconverter.boost_python_to_python_indirect_">boost/python/to_python_indirect.hpp</a></span></dt>
  115. <dt><span class="section"><a href="function_invocation_and_creation/models_of_resultconverter.html#function_invocation_and_creation.models_of_resultconverter.boost_python_to_python_value_hpp">boost/python/to_python_value.hpp</a></span></dt>
  116. </dl></dd>
  117. <dt><span class="section"><a href="function_invocation_and_creation/models_of_resultconvertergenerat.html">Models
  118. of ResultConverterGenerator</a></span></dt>
  119. <dd><dl>
  120. <dt><span class="section"><a href="function_invocation_and_creation/models_of_resultconvertergenerat.html#function_invocation_and_creation.models_of_resultconvertergenerat.boost_python_copy_const_referenc">boost/python/copy_const_reference.hpp</a></span></dt>
  121. <dt><span class="section"><a href="function_invocation_and_creation/models_of_resultconvertergenerat.html#function_invocation_and_creation.models_of_resultconvertergenerat.boost_python_copy_non_const_refe">boost/python/copy_non_const_reference.hpp</a></span></dt>
  122. <dt><span class="section"><a href="function_invocation_and_creation/models_of_resultconvertergenerat.html#function_invocation_and_creation.models_of_resultconvertergenerat.boost_python_manage_new_object_h">boost/python/manage_new_object.hpp</a></span></dt>
  123. <dt><span class="section"><a href="function_invocation_and_creation/models_of_resultconvertergenerat.html#function_invocation_and_creation.models_of_resultconvertergenerat.boost_python_reference_existing_">boost/python/reference_existing_object.hpp</a></span></dt>
  124. <dt><span class="section"><a href="function_invocation_and_creation/models_of_resultconvertergenerat.html#function_invocation_and_creation.models_of_resultconvertergenerat.boost_python_return_by_value_hpp">boost/python/return_by_value.hpp</a></span></dt>
  125. <dt><span class="section"><a href="function_invocation_and_creation/models_of_resultconvertergenerat.html#function_invocation_and_creation.models_of_resultconvertergenerat.boost_python_return_opaque_point">boost/python/return_opaque_pointer.hpp</a></span></dt>
  126. </dl></dd>
  127. </dl>
  128. </div>
  129. <div class="section">
  130. <div class="titlepage"><div><div><h2 class="title" style="clear: both">
  131. <a name="function_invocation_and_creation.boost_python_args_hpp"></a><a class="link" href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp" title="boost/python/args.hpp">boost/python/args.hpp</a>
  132. </h2></div></div></div>
  133. <div class="toc"><dl class="toc">
  134. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.introduction">Introduction</a></span></dt>
  135. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.class_arg">Class
  136. <code class="computeroutput"><span class="identifier">arg</span></code></a></span></dt>
  137. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.class_arg_constructor">Class
  138. <code class="computeroutput"><span class="identifier">arg</span></code> constructor</a></span></dt>
  139. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.class_arg_operator">Class
  140. <code class="computeroutput"><span class="identifier">arg</span></code> operator=</a></span></dt>
  141. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.keyword_expression_operator">Keyword-expression
  142. operator,</a></span></dt>
  143. <dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.example">Example</a></span></dt>
  144. </dl></div>
  145. <div class="section">
  146. <div class="titlepage"><div><div><h3 class="title">
  147. <a name="function_invocation_and_creation.boost_python_args_hpp.introduction"></a><a class="link" href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.introduction" title="Introduction">Introduction</a>
  148. </h3></div></div></div>
  149. <div class="toc"><dl class="toc"><dt><span class="section"><a href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.introduction.keyword_expressions">keyword-expressions</a></span></dt></dl></div>
  150. <p>
  151. Supplies a family of overloaded functions for specifying argument keywords
  152. for wrapped C++ functions.
  153. </p>
  154. <div class="section">
  155. <div class="titlepage"><div><div><h4 class="title">
  156. <a name="function_invocation_and_creation.boost_python_args_hpp.introduction.keyword_expressions"></a><a class="link" href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.introduction.keyword_expressions" title="keyword-expressions">keyword-expressions</a>
  157. </h4></div></div></div>
  158. <p>
  159. A keyword-expression results in an object which holds a sequence of
  160. <a class="link" href="glossary.html#ntbs">ntbs</a>es, and whose type encodes the number
  161. of keywords specified. The keyword-expression may contain default values
  162. for some or all of the keywords it holds
  163. </p>
  164. </div>
  165. </div>
  166. <div class="section">
  167. <div class="titlepage"><div><div><h3 class="title">
  168. <a name="function_invocation_and_creation.boost_python_args_hpp.class_arg"></a><a class="link" href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.class_arg" title="Class arg">Class
  169. <code class="computeroutput"><span class="identifier">arg</span></code></a>
  170. </h3></div></div></div>
  171. <p>
  172. The objects of class arg are keyword-expressions holding one keyword (
  173. size one )
  174. </p>
  175. <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">python</span>
  176. <span class="special">{</span>
  177. <span class="keyword">struct</span> <span class="identifier">arg</span>
  178. <span class="special">{</span>
  179. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
  180. <span class="identifier">arg</span> <span class="special">&amp;</span><span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">value</span><span class="special">);</span>
  181. <span class="keyword">explicit</span> <span class="identifier">arg</span> <span class="special">(</span><span class="keyword">char</span> <span class="keyword">const</span> <span class="special">*</span><span class="identifier">name</span><span class="special">){</span><span class="identifier">elements</span><span class="special">[</span><span class="number">0</span><span class="special">].</span><span class="identifier">name</span> <span class="special">=</span> <span class="identifier">name</span><span class="special">;}</span>
  182. <span class="special">};</span>
  183. <span class="special">}}</span>
  184. </pre>
  185. </div>
  186. <div class="section">
  187. <div class="titlepage"><div><div><h3 class="title">
  188. <a name="function_invocation_and_creation.boost_python_args_hpp.class_arg_constructor"></a><a class="link" href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.class_arg_constructor" title="Class arg constructor">Class
  189. <code class="computeroutput"><span class="identifier">arg</span></code> constructor</a>
  190. </h3></div></div></div>
  191. <pre class="programlisting"><span class="identifier">arg</span><span class="special">(</span><span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">name</span><span class="special">);</span></pre>
  192. <div class="variablelist">
  193. <p class="title"><b></b></p>
  194. <dl class="variablelist">
  195. <dt><span class="term">Requires</span></dt>
  196. <dd><p>
  197. The argument must be a <a class="link" href="glossary.html#ntbs">ntbs</a>.
  198. </p></dd>
  199. <dt><span class="term">Effects</span></dt>
  200. <dd><p>
  201. Constructs an arg object holding a keyword with name name.
  202. </p></dd>
  203. </dl>
  204. </div>
  205. </div>
  206. <div class="section">
  207. <div class="titlepage"><div><div><h3 class="title">
  208. <a name="function_invocation_and_creation.boost_python_args_hpp.class_arg_operator"></a><a class="link" href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.class_arg_operator" title="Class arg operator=">Class
  209. <code class="computeroutput"><span class="identifier">arg</span></code> operator=</a>
  210. </h3></div></div></div>
  211. <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">arg</span> <span class="special">&amp;</span><span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">value</span><span class="special">);</span></pre>
  212. <div class="variablelist">
  213. <p class="title"><b></b></p>
  214. <dl class="variablelist">
  215. <dt><span class="term">Requires</span></dt>
  216. <dd><p>
  217. The argument must convertible to python.
  218. </p></dd>
  219. <dt><span class="term">Effects</span></dt>
  220. <dd><p>
  221. Assigns default value for the keyword.
  222. </p></dd>
  223. <dt><span class="term">Returns</span></dt>
  224. <dd><p>
  225. Reference to <code class="computeroutput"><span class="keyword">this</span></code>.
  226. </p></dd>
  227. </dl>
  228. </div>
  229. </div>
  230. <div class="section">
  231. <div class="titlepage"><div><div><h3 class="title">
  232. <a name="function_invocation_and_creation.boost_python_args_hpp.keyword_expression_operator"></a><a class="link" href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.keyword_expression_operator" title="Keyword-expression operator,">Keyword-expression
  233. operator,</a>
  234. </h3></div></div></div>
  235. <pre class="programlisting"><span class="identifier">keyword</span><span class="special">-</span><span class="identifier">expression</span> <span class="keyword">operator</span> <span class="special">,</span> <span class="special">(</span><span class="identifier">keyword</span><span class="special">-</span><span class="identifier">expression</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">arg</span> <span class="special">&amp;</span><span class="identifier">kw</span><span class="special">)</span> <span class="keyword">const</span>
  236. <span class="identifier">keyword</span><span class="special">-</span><span class="identifier">expression</span> <span class="keyword">operator</span> <span class="special">,</span> <span class="special">(</span><span class="identifier">keyword</span><span class="special">-</span><span class="identifier">expression</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span><span class="identifier">name</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  237. </pre>
  238. <div class="variablelist">
  239. <p class="title"><b></b></p>
  240. <dl class="variablelist">
  241. <dt><span class="term">Requires</span></dt>
  242. <dd><p>
  243. The argument name must be a <a class="link" href="glossary.html#ntbs">ntbs</a>.
  244. </p></dd>
  245. <dt><span class="term">Effects</span></dt>
  246. <dd><p>
  247. Extends the keyword-expression argument with one more keyword.
  248. </p></dd>
  249. <dt><span class="term">Returns</span></dt>
  250. <dd><p>
  251. The extended keyword-expression.
  252. </p></dd>
  253. </dl>
  254. </div>
  255. </div>
  256. <div class="section">
  257. <div class="titlepage"><div><div><h3 class="title">
  258. <a name="function_invocation_and_creation.boost_python_args_hpp.example"></a><a class="link" href="function_invocation_and_creation.html#function_invocation_and_creation.boost_python_args_hpp.example" title="Example">Example</a>
  259. </h3></div></div></div>
  260. <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">python</span><span class="special">/</span><span class="identifier">def</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
  261. <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">python</span><span class="special">;</span>
  262. <span class="keyword">int</span> <span class="identifier">f</span><span class="special">(</span><span class="keyword">double</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="keyword">double</span> <span class="identifier">z</span><span class="special">=</span><span class="number">0.0</span><span class="special">,</span> <span class="keyword">double</span> <span class="identifier">w</span><span class="special">=</span><span class="number">1.0</span><span class="special">);</span>
  263. <span class="identifier">BOOST_PYTHON_MODULE</span><span class="special">(</span><span class="identifier">xxx</span><span class="special">)</span>
  264. <span class="special">{</span>
  265. <span class="identifier">def</span><span class="special">(</span><span class="string">"f"</span><span class="special">,</span> <span class="identifier">f</span><span class="special">,</span> <span class="special">(</span><span class="identifier">arg</span><span class="special">(</span><span class="string">"x"</span><span class="special">),</span> <span class="string">"y"</span><span class="special">,</span> <span class="identifier">arg</span><span class="special">(</span><span class="string">"z"</span><span class="special">)=</span><span class="number">0.0</span><span class="special">,</span> <span class="identifier">arg</span><span class="special">(</span><span class="string">"w"</span><span class="special">)=</span><span class="number">1.0</span><span class="special">));</span>
  266. <span class="special">}</span>
  267. </pre>
  268. </div>
  269. </div>
  270. </div>
  271. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  272. <td align="left"></td>
  273. <td align="right"><div class="copyright-footer">Copyright &#169; 2002-2005, 2015 David Abrahams, Stefan Seefeld<p>
  274. Distributed under the Boost Software License, Version 1.0. (See accompanying
  275. file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>
  276. </p>
  277. </div></td>
  278. </tr></table>
  279. <hr>
  280. <div class="spirit-nav">
  281. <a accesskey="p" href="object_wrappers/boost_python_tuple_hpp.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="function_invocation_and_creation/boost_python_call_hpp.html"><img src="../images/next.png" alt="Next"></a>
  282. </div>
  283. </body>
  284. </html>