123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
- <title>boost/python/tuple.hpp</title>
- <link rel="stylesheet" href="../../boostbook.css" type="text/css">
- <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
- <link rel="home" href="../index.html" title="Boost.Python Reference Manual">
- <link rel="up" href="../object_wrappers.html" title="Chapter 3. Object Wrappers">
- <link rel="prev" href="boost_python_slice_hpp.html" title="boost/python/slice.hpp">
- <link rel="next" href="../function_invocation_and_creation.html" title="Chapter 4. Function Invocation and Creation">
- </head>
- <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
- <table cellpadding="2" width="100%"><tr><td valign="top"><img alt="" width="" height="" src="../../images/boost.png"></td></tr></table>
- <hr>
- <div class="spirit-nav">
- <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>
- </div>
- <div class="section">
- <div class="titlepage"><div><div><h2 class="title" style="clear: both">
- <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>
- </h2></div></div></div>
- <div class="toc"><dl class="toc">
- <dt><span class="section"><a href="boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.introduction">Introduction</a></span></dt>
- <dt><span class="section"><a href="boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.class_tuple">Class
- <code class="computeroutput"><span class="identifier">tuple</span></code></a></span></dt>
- <dt><span class="section"><a href="boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.function_make_tuple">Function
- <code class="computeroutput"><span class="identifier">make_tuple</span></code></a></span></dt>
- <dt><span class="section"><a href="boost_python_tuple_hpp.html#object_wrappers.boost_python_tuple_hpp.example">Example</a></span></dt>
- </dl></div>
- <div class="section">
- <div class="titlepage"><div><div><h3 class="title">
- <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>
- </h3></div></div></div>
- <p>
- Exposes a <a class="link" href="../concepts/objectwrapper.html#concepts.objectwrapper.typewrapper_concept_requirements" title="TypeWrapper Concept Requirements">TypeWrapper</a>
- 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>
- type.
- </p>
- </div>
- <div class="section">
- <div class="titlepage"><div><div><h3 class="title">
- <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
- <code class="computeroutput"><span class="identifier">tuple</span></code></a>
- </h3></div></div></div>
- <p>
- Exposes the interface of Python's built-in tuple type. The semantics of
- the constructors and member functions defined below 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>
- 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.
- </p>
- <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>
- <span class="special">{</span>
- <span class="keyword">class</span> <span class="identifier">tuple</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">object</span>
- <span class="special">{</span>
- <span class="comment">// tuple() -> an empty tuple</span>
- <span class="identifier">tuple</span><span class="special">();</span>
- <span class="comment">// tuple(sequence) -> tuple initialized from sequence's items</span>
- <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
- <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">&</span> <span class="identifier">sequence</span><span class="special">)</span>
- <span class="special">};</span>
- <span class="special">}}</span>
- </pre>
- </div>
- <div class="section">
- <div class="titlepage"><div><div><h3 class="title">
- <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
- <code class="computeroutput"><span class="identifier">make_tuple</span></code></a>
- </h3></div></div></div>
- <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>
- <span class="special">{</span>
- <span class="identifier">tuple</span> <span class="identifier">make_tuple</span><span class="special">();</span>
- <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">A0</span><span class="special">></span>
- <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">&</span> <span class="identifier">a0</span><span class="special">);</span>
- <span class="keyword">template</span> <span class="special"><</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="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">&</span> <span class="identifier">a0</span><span class="special">,</span> <span class="identifier">A1</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">a1</span><span class="special">);</span>
- <span class="special">...</span>
- <span class="keyword">template</span> <span class="special"><</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">></span>
- <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">&</span> <span class="identifier">a0</span><span class="special">,</span> <span class="identifier">A1</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">a1</span><span class="special">,...</span><span class="identifier">An</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">an</span><span class="special">);</span>
- <span class="special">}}</span>
- </pre>
- <div class="variablelist">
- <p class="title"><b></b></p>
- <dl class="variablelist">
- <dt><span class="term">Effect</span></dt>
- <dd><p>
- 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>.
- </p></dd>
- </dl>
- </div>
- </div>
- <div class="section">
- <div class="titlepage"><div><div><h3 class="title">
- <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>
- </h3></div></div></div>
- <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>
- <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>
- <span class="special">{</span>
- <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>
- <span class="special">}</span>
- </pre>
- </div>
- </div>
- <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
- <td align="left"></td>
- <td align="right"><div class="copyright-footer">Copyright © 2002-2005, 2015 David Abrahams, Stefan Seefeld<p>
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- 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>
- </p>
- </div></td>
- </tr></table>
- <hr>
- <div class="spirit-nav">
- <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>
- </div>
- </body>
- </html>
|