boost_python_tuple_hpp.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>boost/python/tuple.hpp</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="../object_wrappers.html" title="Chapter&#160;3.&#160;Object Wrappers">
  9. <link rel="prev" href="boost_python_slice_hpp.html" title="boost/python/slice.hpp">
  10. <link rel="next" href="../function_invocation_and_creation.html" title="Chapter&#160;4.&#160;Function Invocation and Creation">
  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="boost_python_slice_hpp.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../object_wrappers.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.html"><img src="../../images/next.png" alt="Next"></a>
  17. </div>
  18. <div class="section">
  19. <div class="titlepage"><div><div><h2 class="title" style="clear: both">
  20. <a name="object_wrappers.boost_python_tuple_hpp"></a><a class="link" href="boost_python_tuple_hpp.html" title="boost/python/tuple.hpp">boost/python/tuple.hpp</a>
  21. </h2></div></div></div>
  22. <div class="toc"><dl class="toc">
  23. <dt><span class="section"><a href="boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.introduction">Introduction</a></span></dt>
  24. <dt><span class="section"><a href="boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.class_tuple">Class
  25. <code class="computeroutput"><span class="identifier">tuple</span></code></a></span></dt>
  26. <dt><span class="section"><a href="boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.function_make_tuple">Function
  27. <code class="computeroutput"><span class="identifier">make_tuple</span></code></a></span></dt>
  28. <dt><span class="section"><a href="boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.example">Example</a></span></dt>
  29. </dl></div>
  30. <div class="section">
  31. <div class="titlepage"><div><div><h3 class="title">
  32. <a name="object_wrappers.boost_python_tuple_hpp.introduction"></a><a class="link" href="boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.introduction" title="Introduction">Introduction</a>
  33. </h3></div></div></div>
  34. <p>
  35. Exposes a <a class="link" href="../concepts/objectwrapper.html#concepts.objectwrapper.typewrapper_concept_requirements" title="TypeWrapper Concept Requirements">TypeWrapper</a>
  36. for the Python <a href="http://www.python.org/doc/current/tut/node7.html#SECTION007300000000000000000%60tuple%60" target="_top">http://www.python.org/doc/current/tut/node7.html#SECTION007300000000000000000%60tuple%60</a>
  37. type.
  38. </p>
  39. </div>
  40. <div class="section">
  41. <div class="titlepage"><div><div><h3 class="title">
  42. <a name="object_wrappers.boost_python_tuple_hpp.class_tuple"></a><a class="link" href="boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.class_tuple" title="Class tuple">Class
  43. <code class="computeroutput"><span class="identifier">tuple</span></code></a>
  44. </h3></div></div></div>
  45. <p>
  46. Exposes the interface of Python's built-in tuple type. The semantics of
  47. the constructors and member functions defined below can be fully understood
  48. by reading the <a class="link" href="../concepts/objectwrapper.html#concepts.objectwrapper.typewrapper_concept_requirements" title="TypeWrapper Concept Requirements">TypeWrapper</a>
  49. concept definition. Since tuple is publicly derived from <a class="link" href="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">tuple</span></code> instances as well.
  50. </p>
  51. <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>
  52. <span class="special">{</span>
  53. <span class="keyword">class</span> <span class="identifier">tuple</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">object</span>
  54. <span class="special">{</span>
  55. <span class="comment">// tuple() -&gt; an empty tuple</span>
  56. <span class="identifier">tuple</span><span class="special">();</span>
  57. <span class="comment">// tuple(sequence) -&gt; tuple initialized from sequence's items</span>
  58. <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>
  59. <span class="keyword">explicit</span> <span class="identifier">tuple</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">sequence</span><span class="special">)</span>
  60. <span class="special">};</span>
  61. <span class="special">}}</span>
  62. </pre>
  63. </div>
  64. <div class="section">
  65. <div class="titlepage"><div><div><h3 class="title">
  66. <a name="object_wrappers.boost_python_tuple_hpp.function_make_tuple"></a><a class="link" href="boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.function_make_tuple" title="Function make_tuple">Function
  67. <code class="computeroutput"><span class="identifier">make_tuple</span></code></a>
  68. </h3></div></div></div>
  69. <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>
  70. <span class="special">{</span>
  71. <span class="identifier">tuple</span> <span class="identifier">make_tuple</span><span class="special">();</span>
  72. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A0</span><span class="special">&gt;</span>
  73. <span class="identifier">tuple</span> <span class="identifier">make_tuple</span><span class="special">(</span><span class="identifier">A0</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a0</span><span class="special">);</span>
  74. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A0</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">&gt;</span>
  75. <span class="identifier">tuple</span> <span class="identifier">make_tuple</span><span class="special">(</span><span class="identifier">A0</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a0</span><span class="special">,</span> <span class="identifier">A1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a1</span><span class="special">);</span>
  76. <span class="special">...</span>
  77. <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">A0</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">A1</span><span class="special">,...</span><span class="keyword">class</span> <span class="identifier">An</span><span class="special">&gt;</span>
  78. <span class="identifier">tuple</span> <span class="identifier">make_tuple</span><span class="special">(</span><span class="identifier">A0</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a0</span><span class="special">,</span> <span class="identifier">A1</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">a1</span><span class="special">,...</span><span class="identifier">An</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">an</span><span class="special">);</span>
  79. <span class="special">}}</span>
  80. </pre>
  81. <div class="variablelist">
  82. <p class="title"><b></b></p>
  83. <dl class="variablelist">
  84. <dt><span class="term">Effect</span></dt>
  85. <dd><p>
  86. Constructs a new tuple object composed of <code class="computeroutput"><span class="identifier">object</span><span class="special">(</span><span class="identifier">a0</span><span class="special">),</span> <span class="identifier">object</span><span class="special">(</span><span class="identifier">a0</span><span class="special">),...</span><span class="identifier">object</span><span class="special">(</span><span class="identifier">an</span><span class="special">)</span></code>.
  87. </p></dd>
  88. </dl>
  89. </div>
  90. </div>
  91. <div class="section">
  92. <div class="titlepage"><div><div><h3 class="title">
  93. <a name="object_wrappers.boost_python_tuple_hpp.example"></a><a class="link" href="boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.example" title="Example">Example</a>
  94. </h3></div></div></div>
  95. <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>
  96. <span class="identifier">tuple</span> <span class="identifier">head_and_tail</span><span class="special">(</span><span class="identifier">object</span> <span class="identifier">sequence</span><span class="special">)</span>
  97. <span class="special">{</span>
  98. <span class="keyword">return</span> <span class="identifier">make_tuple</span><span class="special">(</span><span class="identifier">sequence</span><span class="special">[</span><span class="number">0</span><span class="special">],</span><span class="identifier">sequence</span><span class="special">[-</span><span class="number">1</span><span class="special">]);</span>
  99. <span class="special">}</span>
  100. </pre>
  101. </div>
  102. </div>
  103. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  104. <td align="left"></td>
  105. <td align="right"><div class="copyright-footer">Copyright &#169; 2002-2005, 2015 David Abrahams, Stefan Seefeld<p>
  106. Distributed under the Boost Software License, Version 1.0. (See accompanying
  107. 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>
  108. </p>
  109. </div></td>
  110. </tr></table>
  111. <hr>
  112. <div class="spirit-nav">
  113. <a accesskey="p" href="boost_python_slice_hpp.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../object_wrappers.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.html"><img src="../../images/next.png" alt="Next"></a>
  114. </div>
  115. </body>
  116. </html>