object_wrappers.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Chapter&#160;3.&#160;Object Wrappers</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="high_level_components/boost_python_wrapper_hpp.html" title="boost/python/wrapper.hpp">
  10. <link rel="next" href="object_wrappers/boost_python_list_hpp.html" title="boost_python_list.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="high_level_components/boost_python_wrapper_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="object_wrappers/boost_python_list_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="object_wrappers"></a>Chapter&#160;3.&#160;Object Wrappers</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="object_wrappers.html#object_wrappers.boost_python_dict_hpp">boost/python/dict.hpp</a></span></dt>
  25. <dd><dl>
  26. <dt><span class="section"><a href="object_wrappers.html#object_wrappers.boost_python_dict_hpp.introduction">Introduction</a></span></dt>
  27. <dt><span class="section"><a href="object_wrappers.html#object_wrappers.boost_python_dict_hpp.class_dict">Class
  28. <code class="computeroutput"><span class="identifier">dict</span></code></a></span></dt>
  29. <dt><span class="section"><a href="object_wrappers.html#object_wrappers.boost_python_dict_hpp.example">Example</a></span></dt>
  30. </dl></dd>
  31. <dt><span class="section"><a href="object_wrappers/boost_python_list_hpp.html">boost_python_list.hpp</a></span></dt>
  32. <dd><dl>
  33. <dt><span class="section"><a href="object_wrappers/boost_python_list_hpp.html#object_wrappers.boost_python_list_hpp.introduction">Introduction</a></span></dt>
  34. <dt><span class="section"><a href="object_wrappers/boost_python_list_hpp.html#object_wrappers.boost_python_list_hpp.class_list">Class
  35. <code class="computeroutput"><span class="identifier">list</span></code></a></span></dt>
  36. <dt><span class="section"><a href="object_wrappers/boost_python_list_hpp.html#object_wrappers.boost_python_list_hpp.example">Example</a></span></dt>
  37. </dl></dd>
  38. <dt><span class="section"><a href="object_wrappers/boost_python_long_hpp.html">boost/python/long.hpp</a></span></dt>
  39. <dd><dl>
  40. <dt><span class="section"><a href="object_wrappers/boost_python_long_hpp.html#object_wrappers.boost_python_long_hpp.introduction">Introduction</a></span></dt>
  41. <dt><span class="section"><a href="object_wrappers/boost_python_long_hpp.html#object_wrappers.boost_python_long_hpp.class_long">Class
  42. <code class="computeroutput"><span class="identifier">long_</span></code></a></span></dt>
  43. <dt><span class="section"><a href="object_wrappers/boost_python_long_hpp.html#object_wrappers.boost_python_long_hpp.example">Example</a></span></dt>
  44. </dl></dd>
  45. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html">boost/python/object.hpp</a></span></dt>
  46. <dd><dl>
  47. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.introduction">Introduction</a></span></dt>
  48. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_slice_nil">Class
  49. <code class="computeroutput"><span class="identifier">slice_nil</span></code></a></span></dt>
  50. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_const_attribute_policies">Class
  51. <code class="computeroutput"><span class="identifier">const_attribute_policies</span></code></a></span></dt>
  52. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_const_attribute_policies_s">Class
  53. <code class="computeroutput"><span class="identifier">const_attribute_policies</span></code>
  54. static functions</a></span></dt>
  55. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_attribute_policies">Class
  56. <code class="computeroutput"><span class="identifier">attribute_policies</span></code></a></span></dt>
  57. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_attribute_policies_static_">Class
  58. <code class="computeroutput"><span class="identifier">attribute_policies</span></code> static
  59. functions</a></span></dt>
  60. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_const_objattribute_policie">Class
  61. <code class="computeroutput"><span class="identifier">const_objattribute_policies</span></code></a></span></dt>
  62. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_const_objattribute_polici0">Class
  63. <code class="computeroutput"><span class="identifier">const_objattribute_policies</span></code>
  64. static functions</a></span></dt>
  65. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_objattribute_policies">Class
  66. <code class="computeroutput"><span class="identifier">objattribute_policies</span></code></a></span></dt>
  67. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_objattribute_policies_stat">Class
  68. <code class="computeroutput"><span class="identifier">objattribute_policies</span></code> static
  69. functions</a></span></dt>
  70. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_const_item_policies">Class
  71. <code class="computeroutput"><span class="identifier">const_item_policies</span></code></a></span></dt>
  72. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_const_item_policies_static">Class
  73. <code class="computeroutput"><span class="identifier">const_item_policies</span></code> static
  74. functions</a></span></dt>
  75. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_item_policies">Class
  76. <code class="computeroutput"><span class="identifier">item_policies</span></code></a></span></dt>
  77. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_item_policies_static_funct">Class
  78. <code class="computeroutput"><span class="identifier">item_policies</span></code> static functions</a></span></dt>
  79. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_const_slice_policies">Class
  80. <code class="computeroutput"><span class="identifier">const_slice_policies</span></code></a></span></dt>
  81. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_const_slice_policies_stati">Class
  82. <code class="computeroutput"><span class="identifier">const_slice_policies</span></code> static
  83. functions</a></span></dt>
  84. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_slice_policies">Class
  85. <code class="computeroutput"><span class="identifier">slice_policies</span></code></a></span></dt>
  86. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_slice_policies_static_func">Class
  87. <code class="computeroutput"><span class="identifier">slice_policies</span></code> static functions</a></span></dt>
  88. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_template_object_operators">Class
  89. template <code class="computeroutput"><span class="identifier">object_operators</span></code></a></span></dt>
  90. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_template_object_operators_">Class
  91. template <code class="computeroutput"><span class="identifier">object_operators</span></code>
  92. observer functions</a></span></dt>
  93. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_object">Class
  94. <code class="computeroutput"><span class="identifier">object</span></code></a></span></dt>
  95. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_object_constructors_and_de">Class
  96. <code class="computeroutput"><span class="identifier">object</span></code> constructors and destructor</a></span></dt>
  97. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_object_modifiers">Class
  98. <code class="computeroutput"><span class="identifier">object</span></code> modifiers</a></span></dt>
  99. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_template_proxy">Class
  100. template <code class="computeroutput"><span class="identifier">proxy</span></code></a></span></dt>
  101. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_template_proxy_observer_fu">Class
  102. template <code class="computeroutput"><span class="identifier">proxy</span></code> observer functions</a></span></dt>
  103. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_template_proxy_modifier_fu">Class
  104. template <code class="computeroutput"><span class="identifier">proxy</span></code> modifier functions</a></span></dt>
  105. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.functions">Functions</a></span></dt>
  106. <dt><span class="section"><a href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.example">Example</a></span></dt>
  107. </dl></dd>
  108. <dt><span class="section"><a href="object_wrappers/boost_python_str_hpp.html">boost/python/str.hpp</a></span></dt>
  109. <dd><dl>
  110. <dt><span class="section"><a href="object_wrappers/boost_python_str_hpp.html#object_wrappers.boost_python_str_hpp.introduction">Introduction</a></span></dt>
  111. <dt><span class="section"><a href="object_wrappers/boost_python_str_hpp.html#object_wrappers.boost_python_str_hpp.class_str">Class
  112. <code class="computeroutput"><span class="identifier">str</span></code></a></span></dt>
  113. <dt><span class="section"><a href="object_wrappers/boost_python_str_hpp.html#object_wrappers.boost_python_str_hpp.example">Example</a></span></dt>
  114. </dl></dd>
  115. <dt><span class="section"><a href="object_wrappers/boost_python_slice_hpp.html">boost/python/slice.hpp</a></span></dt>
  116. <dd><dl>
  117. <dt><span class="section"><a href="object_wrappers/boost_python_slice_hpp.html#object_wrappers.boost_python_slice_hpp.introduction">Introduction</a></span></dt>
  118. <dt><span class="section"><a href="object_wrappers/boost_python_slice_hpp.html#object_wrappers.boost_python_slice_hpp.class_slice">Class
  119. <code class="computeroutput"><span class="identifier">slice</span></code></a></span></dt>
  120. <dt><span class="section"><a href="object_wrappers/boost_python_slice_hpp.html#object_wrappers.boost_python_slice_hpp.class_slice_constructors">Class
  121. <code class="computeroutput"><span class="identifier">slice</span></code> constructors</a></span></dt>
  122. <dt><span class="section"><a href="object_wrappers/boost_python_slice_hpp.html#object_wrappers.boost_python_slice_hpp.class_slice_observer_functions">Class
  123. <code class="computeroutput"><span class="identifier">slice</span></code> observer functions</a></span></dt>
  124. <dt><span class="section"><a href="object_wrappers/boost_python_slice_hpp.html#object_wrappers.boost_python_slice_hpp.example">Example</a></span></dt>
  125. </dl></dd>
  126. <dt><span class="section"><a href="object_wrappers/boost_python_tuple_hpp.html">boost/python/tuple.hpp</a></span></dt>
  127. <dd><dl>
  128. <dt><span class="section"><a href="object_wrappers/boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.introduction">Introduction</a></span></dt>
  129. <dt><span class="section"><a href="object_wrappers/boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.class_tuple">Class
  130. <code class="computeroutput"><span class="identifier">tuple</span></code></a></span></dt>
  131. <dt><span class="section"><a href="object_wrappers/boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.function_make_tuple">Function
  132. <code class="computeroutput"><span class="identifier">make_tuple</span></code></a></span></dt>
  133. <dt><span class="section"><a href="object_wrappers/boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.example">Example</a></span></dt>
  134. </dl></dd>
  135. </dl>
  136. </div>
  137. <div class="section">
  138. <div class="titlepage"><div><div><h2 class="title" style="clear: both">
  139. <a name="object_wrappers.boost_python_dict_hpp"></a><a class="link" href="object_wrappers.html#object_wrappers.boost_python_dict_hpp" title="boost/python/dict.hpp">boost/python/dict.hpp</a>
  140. </h2></div></div></div>
  141. <div class="toc"><dl class="toc">
  142. <dt><span class="section"><a href="object_wrappers.html#object_wrappers.boost_python_dict_hpp.introduction">Introduction</a></span></dt>
  143. <dt><span class="section"><a href="object_wrappers.html#object_wrappers.boost_python_dict_hpp.class_dict">Class
  144. <code class="computeroutput"><span class="identifier">dict</span></code></a></span></dt>
  145. <dt><span class="section"><a href="object_wrappers.html#object_wrappers.boost_python_dict_hpp.example">Example</a></span></dt>
  146. </dl></div>
  147. <div class="section">
  148. <div class="titlepage"><div><div><h3 class="title">
  149. <a name="object_wrappers.boost_python_dict_hpp.introduction"></a><a class="link" href="object_wrappers.html#object_wrappers.boost_python_dict_hpp.introduction" title="Introduction">Introduction</a>
  150. </h3></div></div></div>
  151. <p>
  152. Exposes a <a class="link" href="concepts/objectwrapper.html#concepts.objectwrapper.typewrapper_concept_requirements" title="TypeWrapper Concept Requirements">TypeWrapper</a>
  153. for the Python <a href="http://www.python.org/dev/doc/devel/lib/typesmapping.html" target="_top"><code class="computeroutput"><span class="identifier">dict</span></code></a> type.
  154. </p>
  155. </div>
  156. <div class="section">
  157. <div class="titlepage"><div><div><h3 class="title">
  158. <a name="object_wrappers.boost_python_dict_hpp.class_dict"></a><a class="link" href="object_wrappers.html#object_wrappers.boost_python_dict_hpp.class_dict" title="Class dict">Class
  159. <code class="computeroutput"><span class="identifier">dict</span></code></a>
  160. </h3></div></div></div>
  161. <p>
  162. Exposes the <a href="http://www.python.org/dev/doc/devel/lib/typesmapping.html" target="_top">mapping
  163. protocol</a> of Python's built-in <code class="computeroutput"><span class="identifier">dict</span></code>
  164. type. The semantics of the constructors and member functions defined below
  165. can be fully understood by reading the <a class="link" href="concepts/objectwrapper.html#concepts.objectwrapper.typewrapper_concept_requirements" title="TypeWrapper Concept Requirements">TypeWrapper</a>
  166. concept definition. Since <code class="computeroutput"><span class="identifier">dict</span></code>
  167. is publicly derived from <a class="link" href="object_wrappers/boost_python_object_hpp.html#object_wrappers.boost_python_object_hpp.class_object" title="Class object"><code class="computeroutput"><span class="identifier">object</span></code></a>, the public <code class="computeroutput"><span class="identifier">object</span></code> interface applies to <code class="computeroutput"><span class="identifier">dict</span></code> instances as well.
  168. </p>
  169. <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>
  170. <span class="special">{</span>
  171. <span class="keyword">class</span> <span class="identifier">dict</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">object</span>
  172. <span class="special">{</span>
  173. <span class="identifier">dict</span><span class="special">();</span>
  174. <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>
  175. <span class="identifier">dict</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">data</span><span class="special">);</span>
  176. <span class="comment">// modifiers</span>
  177. <span class="keyword">void</span> <span class="identifier">clear</span><span class="special">();</span>
  178. <span class="identifier">dict</span> <span class="identifier">copy</span><span class="special">();</span>
  179. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
  180. <span class="identifier">tuple</span> <span class="identifier">popitem</span><span class="special">();</span>
  181. <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>
  182. <span class="identifier">object</span> <span class="identifier">setdefault</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">k</span><span class="special">);</span>
  183. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
  184. <span class="identifier">object</span> <span class="identifier">setdefault</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">d</span><span class="special">);</span>
  185. <span class="keyword">void</span> <span class="identifier">update</span><span class="special">(</span><span class="identifier">object_cref</span> <span class="identifier">E</span><span class="special">);</span>
  186. <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>
  187. <span class="keyword">void</span> <span class="identifier">update</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">E</span><span class="special">);</span>
  188. <span class="comment">// observers</span>
  189. <span class="identifier">list</span> <span class="identifier">values</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
  190. <span class="identifier">object</span> <span class="identifier">get</span><span class="special">(</span><span class="identifier">object_cref</span> <span class="identifier">k</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  191. <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>
  192. <span class="identifier">object</span> <span class="identifier">get</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">k</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  193. <span class="identifier">object</span> <span class="identifier">get</span><span class="special">(</span><span class="identifier">object_cref</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">object_cref</span> <span class="identifier">d</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  194. <span class="identifier">object</span> <span class="identifier">get</span><span class="special">(</span><span class="identifier">T1</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">T2</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">d</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  195. <span class="keyword">bool</span> <span class="identifier">has_key</span><span class="special">(</span><span class="identifier">object_cref</span> <span class="identifier">k</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  196. <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>
  197. <span class="keyword">bool</span> <span class="identifier">has_key</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">k</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  198. <span class="identifier">list</span> <span class="identifier">items</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
  199. <span class="identifier">object</span> <span class="identifier">iteritems</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
  200. <span class="identifier">object</span> <span class="identifier">iterkeys</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
  201. <span class="identifier">object</span> <span class="identifier">itervalues</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
  202. <span class="identifier">list</span> <span class="identifier">keys</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
  203. <span class="special">};</span>
  204. <span class="special">}}</span>
  205. </pre>
  206. </div>
  207. <div class="section">
  208. <div class="titlepage"><div><div><h3 class="title">
  209. <a name="object_wrappers.boost_python_dict_hpp.example"></a><a class="link" href="object_wrappers.html#object_wrappers.boost_python_dict_hpp.example" title="Example">Example</a>
  210. </h3></div></div></div>
  211. <pre class="programlisting"><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>
  212. <span class="identifier">dict</span> <span class="identifier">swap_object_dict</span><span class="special">(</span><span class="identifier">object</span> <span class="identifier">target</span><span class="special">,</span> <span class="identifier">dict</span> <span class="identifier">d</span><span class="special">)</span>
  213. <span class="special">{</span>
  214. <span class="identifier">dict</span> <span class="identifier">result</span> <span class="special">=</span> <span class="identifier">extract</span><span class="special">&lt;</span><span class="identifier">dict</span><span class="special">&gt;(</span><span class="identifier">target</span><span class="special">.</span><span class="identifier">attr</span><span class="special">(</span><span class="string">"__dict__"</span><span class="special">));</span>
  215. <span class="identifier">target</span><span class="special">.</span><span class="identifier">attr</span><span class="special">(</span><span class="string">"__dict__"</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">d</span><span class="special">;</span>
  216. <span class="keyword">return</span> <span class="identifier">result</span><span class="special">;</span>
  217. <span class="special">}</span>
  218. </pre>
  219. </div>
  220. </div>
  221. </div>
  222. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  223. <td align="left"></td>
  224. <td align="right"><div class="copyright-footer">Copyright &#169; 2002-2005, 2015 David Abrahams, Stefan Seefeld<p>
  225. Distributed under the Boost Software License, Version 1.0. (See accompanying
  226. 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>
  227. </p>
  228. </div></td>
  229. </tr></table>
  230. <hr>
  231. <div class="spirit-nav">
  232. <a accesskey="p" href="high_level_components/boost_python_wrapper_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="object_wrappers/boost_python_list_hpp.html"><img src="../images/next.png" alt="Next"></a>
  233. </div>
  234. </body>
  235. </html>