Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/doc/v2/indexing.html @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 25.8 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<!-- Copyright David Abrahams 2006. Distributed under the Boost -->
3<!-- Software License, Version 1.0. (See accompanying -->
4<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
5<html>
6  <head>
7    <meta name="generator" content=
8    "HTML Tidy for Windows (vers 1st February 2003), see www.w3.org">
9    <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
10    <link rel="stylesheet" type="text/css" href="../boost.css">
11    <title>
12      Indexing Support
13    </title>
14  </head>
15  <body>
16    <table border="0" cellpadding="7" cellspacing="0" width="100%"
17           summary="header">
18      <tr>
19        <td valign="top" width="300">
20          <h3>
21            <a href="../../../../index.htm"><img height="86" width="277"
22                 alt="C++ Boost" src="../../../../boost.png" border=
23                 "0"></a>
24          </h3>
25        </td>
26        <td valign="top">
27          <h1 align="center">
28            <a href="../index.html">Boost.Python</a>
29          </h1>
30         
31      <h2> Headers &lt;boost/python/indexing/indexing_suite.hpp&gt;<br>
32        &lt;boost/python/indexing/vector_indexing_suite.hpp&gt;</h2>
33        </td>
34      </tr>
35    </table>
36    <hr>
37    <h2>
38      Contents
39    </h2>
40    <dl class="page-index">
41      <dt>
42        <a href="#introduction">Introduction</a>
43      </dt>
44      <dt>
45        <a href="#interface">Interface</a>
46      </dt>
47      <dd>
48        <dl class="page-index">
49          <dt>
50            <a href="#indexing_suite">indexing_suite</a>
51          </dt>
52          <dt>
53            <a href="#indexing_suite_subclasses">indexing_suite
54            sub-classes</a>
55          </dt>
56          <dd>
57            <dl class="page-index">
58              <dt>
59                <a href="#vector_indexing_suite">vector_indexing_suite</a>
60              </dt>
61            </dl>
62          </dd>
63        </dl>
64      </dd>
65    </dl>
66    <dl>
67      <dt>
68        <a href="#indexing_suite_class">indexing_suite class</a>
69      </dt>
70      <dt>
71        <a href="#vector_indexing_suite_class">vector_indexing_suite
72        class<br>
73        </a><a href="#map_indexing_suite_class">map_indexing_suite class</a> </dt>
74    </dl>
75    <hr>
76    <h2>
77      <a name="introduction" id="introduction"></a>Introduction
78    </h2>
79    <p>
80      Indexing is a Boost Python facility for easy exportation of indexable
81      C++ containers to Python. Indexable containers are containers that
82      allow random access through the operator[] (e.g. std::vector).
83    </p>
84    <p>
85      While Boost Python has all the facilities needed to expose indexable
86      C++ containers such as the ubiquitous std::vector to Python, the
87      procedure is not as straightforward as we'd like it to be. Python
88      containers do not map easily to C++ containers. Emulating Python
89      containers in C++ (see Python Reference Manual, <a href=
90      "http://www.python.org/doc/current/ref/sequence-types.html">Emulating
91      container types</a>) using Boost Python is non trivial. There are a lot
92      of issues to consider before we can map a C++ container to Python.
93      These involve implementing wrapper functions for the methods
94      <strong>__len__</strong>, <strong>__getitem__</strong>,
95      <strong>__setitem__</strong>, <strong>__delitem__,</strong>
96      <strong>__iter__</strong> and <strong>__contains</strong>.
97    </p>
98    <p>
99      The goals:
100    </p>
101    <ul>
102      <li>
103        <div>
104          Make indexable C++ containers behave exactly as one would expect a
105          Python container to behave.
106        </div>
107      </li>
108      <li>
109        Provide default reference semantics for container element indexing
110        (<tt>__getitem__</tt>) such that <tt>c[i]</tt> can be mutable.
111        Require:
112        <div>
113          <pre>
114    val = c[i]
115    c[i].m()
116    val == c[i]
117          </pre>
118        </div>where <tt>m</tt> is a non-const (mutating) member function
119        (method).
120      </li>
121      <li>
122        Return safe references from <tt>__getitem__</tt> such that subsequent
123        adds and deletes to and from the container will not result in
124        dangling references (will not crash Python).
125      </li>
126      <li>
127        Support slice indexes.
128      </li>
129      <li>
130        Accept Python container arguments (e.g. lists, tuples) wherever
131        appropriate.
132      </li>
133      <li>
134        Allow for extensibility through re-definable policy classes.
135      </li>
136      <li>
137        Provide predefined support for the most common STL and STL like
138        indexable containers.
139      </li>
140    </ul>
141    <hr>
142   
143<h2> <a name="interface"></a>The Boost.Python Indexing Interface</h2>
144<h3> <a name="indexing_suite"></a>indexing_suite [ Header &lt;boost/python/indexing/indexing_suite.hpp&gt; 
145  ]</h3>
146    <p>
147      The <tt>indexing_suite</tt> class is the base  class for the
148      management of C++ containers intended to be integrated to Python. The
149      objective is make a C++ container look and feel and behave exactly as
150      we'd expect a Python container. The class automatically wraps these
151      special Python methods (taken from the Python reference: <a href=
152      "http://www.python.org/doc/current/ref/sequence-types.html">Emulating
153      container types</a>):
154    </p>
155    <dl>
156      <dd>
157        <dl>
158          <dt>
159            <b><a name="l2h-126"><tt class=
160            "method">__len__</tt></a></b>(<var>self</var>)
161          </dt>
162          <dd>
163            Called to implement the built-in function <tt class=
164            "function">len()</tt><a name="l2h-134">&nbsp;</a> Should return
165            the length of the object, an integer <code>&gt;=</code> 0. Also,
166            an object that doesn't define a <tt class=
167            "method">__nonzero__()</tt> method and whose <tt class=
168            "method">__len__()</tt> method returns zero is considered to be
169            false in a Boolean context. <a name="l2h-128">&nbsp;</a>
170          </dd>
171        </dl>
172        <dl>
173          <dt>
174            <b><a name="l2h-129"><tt class=
175            "method">__getitem__</tt></a></b>(<var>self, key</var>)
176          </dt>
177          <dd>
178            Called to implement evaluation of
179            <code><var>self</var>[<var>key</var>]</code>. For sequence types,
180            the accepted keys should be integers and slice
181                objects.<a name="l2h-135">&nbsp;</a> Note that the special
182                interpretation of negative indexes (if the class wishes to
183                emulate a sequence type) is up to the <tt class=
184                "method">__getitem__()</tt> method. If <var>key</var> is of
185                an inappropriate type, <tt class="exception">TypeError</tt>
186                may be raised; if of a value outside the set of indexes for
187                the sequence (after any special interpretation of negative
188                values), <tt class="exception">IndexError</tt> should be
189                raised. <span class="note"><b class="label">Note:</b>
190                <tt class="keyword">for</tt> loops expect that an <tt class=
191                "exception">IndexError</tt> will be raised for illegal
192                indexes to allow proper detection of the end of the
193                sequence.</span>
194          </dd>
195        </dl>
196        <dl>
197          <dt>
198            <b><a name="l2h-130"><tt class=
199            "method">__setitem__</tt></a></b>(<var>self, key, value</var>)
200          </dt>
201          <dd>
202            Called to implement assignment to
203            <code><var>self</var>[<var>key</var>]</code>. Same note as for
204            <tt class="method">__getitem__()</tt>. This should only be
205            implemented for mappings if the objects support changes to the
206            values for keys, or if new keys can be added, or for sequences if
207            elements can be replaced. The same exceptions should be raised
208            for improper <var>key</var> values as for the <tt class=
209            "method">__getitem__()</tt> method.
210          </dd>
211        </dl>
212        <dl>
213          <dt>
214            <b><a name="l2h-131"><tt class=
215            "method">__delitem__</tt></a></b>(<var>self, key</var>)
216          </dt>
217          <dd>
218            Called to implement deletion of
219            <code><var>self</var>[<var>key</var>]</code>. Same note as for
220            <tt class="method">__getitem__()</tt>. This should only be
221            implemented for mappings if the objects support removal of keys,
222            or for sequences if elements can be removed from the sequence.
223            The same exceptions should be raised for improper <var>key</var>
224            values as for the <tt class="method">__getitem__()</tt> method.
225          </dd>
226        </dl>
227        <dl>
228          <dt>
229            <b><a name="l2h-132"><tt class=
230            "method">__iter__</tt></a></b>(<var>self</var>)
231          </dt>
232          <dd>
233            This method is called when an iterator is required for a
234            container. This method should return a new iterator object that
235            can iterate over all the objects in the container. For mappings,
236            it should iterate over the keys of the container, and should also
237            be made available as the method <tt class=
238            "method">iterkeys()</tt>.
239            <p>
240              Iterator objects also need to implement this method; they are
241              required to return themselves. For more information on iterator
242              objects, see ``<a class="ulink" href=
243              "http://www.python.org/doc/current/lib/typeiter.html">Iterator
244              Types</a>'' in the <em class="citetitle"><a href=
245              "http://www.python.org/doc/current/lib/lib.html" title=
246              "Python Library Reference">Python Library Reference</a></em>.
247            </p>
248          </dd>
249        </dl>
250        <dl>
251          <dt>
252            <b><a name="l2h-133"><tt class=
253            "method">__contains__</tt></a></b>(<var>self, item</var>)
254          </dt>
255          <dd>
256            Called to implement membership test operators. Should return true
257            if <var>item</var> is in <var>self</var>, false otherwise. For
258            mapping objects, this should consider the keys of the mapping
259            rather than the values or the key-item pairs.
260          </dd>
261        </dl>
262      </dd>
263    </dl>
264   
265<h3> <a name="indexing_suite_subclasses"></a>indexing_suite sub-classes</h3>
266    <p>
267      The <tt>indexing_suite</tt> is not meant to be used as is. A couple of
268      policy functions must be supplied by subclasses of
269      <tt>indexing_suite</tt>. However, a set of <tt>indexing_suite</tt>
270      subclasses for the standard indexable STL containers will be provided,
271      In most cases, we can simply use the available predefined suites. In
272      some cases, we can refine the predefined suites to suit our needs.
273    </p>
274   
275<h3> <a name="vector_indexing_suite"></a>vector_indexing_suite [ Header &lt;boost/python/indexing/vector_indexing_suite.hpp&gt; 
276  ] </h3>
277<p>
278      The <tt>vector_indexing_suite</tt> class is a predefined
279      <tt>indexing_suite</tt> derived class designed to wrap
280      <tt>std::vector</tt> (and <tt>std::vector</tt> like [i.e. a class with
281      std::vector interface]) classes. It provides all the policies required by the
282      <tt>indexing_suite</tt>.
283  </p>
284    <p>
285      Example usage:
286    </p>
287    <pre>
288    class X {...};
289    ...
290
291    class_&lt;std::vector&lt;X&gt; &gt;("XVec")
292        .def(vector_indexing_suite&lt;std::vector&lt;X&gt; &gt;())
293    ;
294</pre>
295    <p>
296      <tt>XVec</tt> is now a full-fledged Python container (see the
297         <a href="../../test/vector_indexing_suite.cpp">example in full</a>,
298         along with its <a href="../../test/vector_indexing_suite.py">python
299         test</a>).
300</p>
301    <h3><a name="map_indexing_suite" id="map_indexing_suite"></a>map_indexing_suite [ Header &lt;boost/python/indexing/map_indexing_suite.hpp&gt; ] </h3>
302    <p> The <tt>map_indexing_suite</tt> class is a predefined <tt>indexing_suite</tt> derived class designed to wrap <tt>std::map</tt> (and <tt>std::map</tt> like [i.e. a class with std::map interface]) classes. It provides all the policies required by the <tt>indexing_suite</tt>. </p>
303    <p> Example usage: </p>
304    <pre>
305    class X {...};
306    ...
307
308    class_&lt;std::map&lt;X&gt; &gt;("XMap")
309        .def(map_indexing_suite&lt;std::map&lt;X&gt; &gt;())
310    ;
311</pre>
312    <p> By default indexed elements are returned by proxy. This can be disabled by supplying <tt>true</tt> in the NoProxy template parameter. <tt>XMap</tt> is now a full-fledged Python container (see the <a href="../../test/map_indexing_suite.cpp">example in full</a>, along with its <a href="../../test/map_indexing_suite.py">python test</a>).</p>
313    <hr>
314    <h2>
315      <a name="indexing_suite_class"></a>indexing_suite class    </h2>
316    <h2>  <tt>indexing_suite&lt;<br>
317    </tt><tt>class Container<br>
318       , class DerivedPolicies<font color="#007F00"><br>
319       </font></tt> <tt>,
320          bool NoProxy<br>
321       ,
322  bool NoSlice<br>
323       </tt><tt>, class Data<br>
324      , class Index<br>
325    </tt><tt>, class Key</tt></h2>
326    <table width="100%" border="1">
327      <tr>
328        <td>
329          <strong>Template Parameter</strong><br>
330        </td>
331        <td>
332          <strong>Requirements</strong>
333        </td>
334        <td>
335          <strong>Semantics</strong>
336        </td>
337        <td>
338          <strong>Default</strong>
339        </td>
340      </tr>
341      <tr>
342        <td>
343          <font color="#007F00"><tt>Container</tt></font>
344        </td>
345        <td>
346          A class type
347        </td>
348        <td>
349          The container type to be wrapped to Python.
350        </td>
351        <td>&nbsp;
352         
353        </td>
354      </tr>
355      <tr>
356        <td>
357          <font color="#007F00"><tt>DerivedPolicies</tt></font>
358        </td>
359        <td>
360          A subclass of indexing_suite
361        </td>
362        <td>
363          Derived classes provide the policy hooks. See <a href=
364          "#DerivedPolicies">DerivedPolicies</a> below.
365        </td>
366        <td>&nbsp;
367         
368        </td>
369      </tr>
370      <tr>
371        <td> <font color="#007F00"><tt>NoProxy</tt></font> </td>
372        <td> A boolean </td>
373        <td> By default indexed elements have Python reference semantics and are returned by proxy. This can be disabled by supplying <strong>true</strong> in the <tt>NoProxy</tt> template parameter. </td>
374        <td> false </td>
375      </tr>
376      <tr>
377        <td>
378          <font color="#007F00"><tt>NoSlice</tt></font>
379        </td>
380        <td>
381          A boolean
382        </td>
383        <td>
384          Do not allow slicing. </td>
385        <td>
386          false
387        </td>
388      </tr>
389      <tr>
390        <td>
391          <font color="#007F00"><tt>Data</tt></font>
392        </td>
393        <td>&nbsp;
394         
395        </td>
396        <td>
397          The container's data type.
398        </td>
399        <td>
400          <tt>Container::value_type</tt>
401        </td>
402      </tr>
403      <tr>
404        <td> <font color="#007F00"><tt>Index</tt></font> </td>
405        <td>&nbsp; </td>
406        <td> The container's index type. </td>
407        <td> <tt>Container::size_type</tt> </td>
408      </tr>
409      <tr>
410        <td>
411          <font color="#007F00"><tt>Key</tt></font>
412        </td>
413        <td>&nbsp;
414         
415        </td>
416        <td>
417          The container's key type.
418        </td>
419        <td>
420          <tt>Container::value_type</tt>
421        </td>
422      </tr>
423  </table>
424    <pre>
425    template &lt;<br>          class Container
426        , class DerivedPolicies
427        , bool NoProxy = false<br>        , bool NoSlice = false
428        , class Data = typename Container::value_type
429        , class Index = typename Container::size_type
430        , class Key = typename Container::value_type
431    &gt;<br>    class indexing_suite
432        : unspecified
433    {
434    public:
435
436        indexing_suite(); // default constructor
437    }
438    </pre>
439    <h2>
440      <tt><a name="DerivedPolicies"></a>DerivedPolicies</tt>
441    </h2>
442    <dl>
443      <dd>
444        Derived classes provide the hooks needed by
445        the <tt>indexing_suite:</tt>
446      </dd>
447    </dl>
448    <pre>        data_type&amp;
449        get_item(Container&amp; container, index_type i);
450
451        static object
452        get_slice(Container&amp; container, index_type from, index_type to);
453
454        static void
455        set_item(Container&amp; container, index_type i, data_type const&amp; v);
456
457        static void
458        set_slice(
459            Container&amp; container, index_type from,
460            index_type to, data_type const&amp; v
461        );
462
463        template &lt;class Iter&gt;
464        static void<br>        set_slice(Container&amp; container, index_type from,
465            index_type to, Iter first, Iter last
466        );
467
468        static void
469        delete_item(Container&amp; container, index_type i);
470
471        static void
472        delete_slice(Container&amp; container, index_type from, index_type to);
473
474        static size_t
475        size(Container&amp; container);
476
477        template &lt;class T&gt;
478        static bool
479        contains(Container&amp; container, T const&amp; val);
480
481        static index_type
482        convert_index(Container&amp; container, PyObject* i);
483
484        static index_type
485        adjust_index(index_type current, index_type from,
486            index_type to, size_type len
487        );
488</pre>
489    <blockquote>
490      <p>
491        Most of these policies are self explanatory. <tt>However,
492        <strong>convert_index</strong></tt> and
493        <tt><strong>adjust_index</strong></tt> deserve some explanation.
494      </p>
495      <p>
496        <strong><tt>convert_index</tt></strong> converts a Python index into
497        a C++ index that the container can handle. For instance, negative
498        indexes in Python, by convention, start counting from the right(e.g.
499        <tt>C[-1]</tt> indexes the rightmost element in <tt>C</tt>).
500        <strong><tt>convert_index</tt></strong> should handle the necessary
501        conversion for the C++ container (e.g. convert <tt>-1</tt> to
502        <tt>C.size()-1</tt>). <tt><strong>convert_index</strong></tt> should
503        also be able to convert the type of the index (A dynamic Python type)
504        to the actual type that the C++ container expects.
505      </p>
506      <p>
507        When a container expands or contracts, held indexes to its elements
508        must be adjusted to follow the movement of data. For instance, if we
509        erase 3 elements, starting from index 0 from a 5 element vector, what
510        used to be at index 4 will now be at index 1:
511      </p>
512      <pre>
513    [a][b][c][d][e] ---&gt; [d][e]
514                 ^           ^
515                 4           1
516</pre>
517      <p>
518        <strong><tt>adjust_index</tt></strong> takes care of the adjustment.
519        Given a current index, the function should return the adjusted index
520        when data in the container at index <tt>from</tt>..<tt>to</tt> is
521        replaced by <tt>len</tt> elements.
522      </p>
523    </blockquote>
524    <div>
525      <hr>
526      <h2>
527        <a name="vector_indexing_suite_class"></a>vector_indexing_suite class
528      </h2>
529      <h3>
530        Class template <tt><br>
531         vector_indexing_suite&lt;<br>
532         class <font color="#007F00">Container</font><br>
533         , bool <font color="#007F00">NoProxy</font><br>
534         , class <font color="#007F00">DerivedPolicies</font>&gt;</tt>
535      </h3>
536      <table width="100%" border="1">
537        <tr>
538          <td>
539            <strong>Template Parameter</strong><br>
540          </td>
541          <td>
542            <strong>Requirements</strong>
543          </td>
544          <td>
545            <strong>Semantics</strong>
546          </td>
547          <td>
548            <strong>Default</strong>
549          </td>
550        </tr>
551        <tr>
552          <td>
553            <font color="#007F00"><tt>Container</tt></font>
554          </td>
555          <td>
556            A class type
557          </td>
558          <td>
559            The container type to be wrapped to Python.
560          </td>
561          <td>&nbsp;
562           
563          </td>
564        </tr>
565        <tr>
566          <td>
567            <font color="#007F00"><tt>NoProxy</tt></font>
568          </td>
569          <td>
570            A boolean
571          </td>
572          <td>
573            By default indexed elements have Python reference semantics and
574            are returned by proxy. This can be disabled by supplying
575            <strong>true</strong> in the <tt>NoProxy</tt> template parameter.
576          </td>
577          <td>
578            false
579          </td>
580        </tr>
581        <tr>
582          <td>
583            <font color="#007F00"><tt>DerivedPolicies</tt></font>
584          </td>
585          <td>
586            A subclass of indexing_suite
587          </td>
588          <td>
589            The <tt>vector_indexing_suite</tt> may still be derived to
590            further tweak any of the predefined policies. Static polymorphism
591            through CRTP (James Coplien. "Curiously Recurring Template
592            Pattern". C++ Report, Feb. 1995) enables the base
593            <tt>indexing_suite</tt> class to call policy function of the most
594            derived class
595          </td>
596          <td>&nbsp;
597           
598          </td>
599        </tr>
600      </table>
601      <pre>
602    template &lt;<br>        class Container,<br>        bool NoProxy = false,<br>        class DerivedPolicies = unspecified_default<br>    class vector_indexing_suite : unspecified_base<br>    {<br>    public:<br><br>        typedef typename Container::value_type data_type;<br>        typedef typename Container::value_type key_type;<br>        typedef typename Container::size_type index_type;<br>        typedef typename Container::size_type size_type;<br>        typedef typename Container::difference_type difference_type;<br>    <br>        data_type&amp;<br>        get_item(Container&amp; container, index_type i);
603
604        static object
605        get_slice(Container&amp; container, index_type from, index_type to);
606
607        static void<br>        set_item(Container&amp; container, index_type i, data_type const&amp; v);
608
609        static void
610        set_slice(Container&amp; container, index_type from,
611            index_type to, data_type const&amp; v);
612
613        template &lt;class Iter&gt;<br>        static void<br>        set_slice(Container&amp; container, index_type from,<br>            index_type to, Iter first, Iter last);
614
615        static void
616        delete_item(Container&amp; container, index_type i);
617
618        static void
619        delete_slice(Container&amp; container, index_type from, index_type to);<br>     
620        static size_t
621        size(Container&amp; container);
622     
623        static bool
624        contains(Container&amp; container, key_type const&amp; key);
625     
626        static index_type
627        convert_index(Container&amp; container, PyObject* i);
628     
629        static index_type
630        adjust_index(index_type current, index_type from,
631            index_type to, size_type len);
632    };
633
634</pre>
635      <h2><a name="vector_indexing_suite_class"></a>map_indexing_suite class </h2>
636      <h3> Class template <tt><br>
637  map_indexing_suite&lt;<br>
638  class <font color="#007F00">Container</font><br>
639  , bool <font color="#007F00">NoProxy</font><br>
640  , class <font color="#007F00">DerivedPolicies</font>&gt;</tt> </h3>
641      <table width="100%" border="1">
642        <tr>
643          <td> <strong>Template Parameter</strong><br>
644          </td>
645          <td> <strong>Requirements</strong> </td>
646          <td> <strong>Semantics</strong> </td>
647          <td> <strong>Default</strong> </td>
648        </tr>
649        <tr>
650          <td> <font color="#007F00"><tt>Container</tt></font> </td>
651          <td> A class type </td>
652          <td> The container type to be wrapped to Python. </td>
653          <td>&nbsp; </td>
654        </tr>
655        <tr>
656          <td> <font color="#007F00"><tt>NoProxy</tt></font> </td>
657          <td> A boolean </td>
658          <td> By default indexed elements have Python reference semantics and are returned by proxy. This can be disabled by supplying <strong>true</strong> in the <tt>NoProxy</tt> template parameter. </td>
659          <td> false </td>
660        </tr>
661        <tr>
662          <td> <font color="#007F00"><tt>DerivedPolicies</tt></font> </td>
663          <td> A subclass of indexing_suite </td>
664          <td> The <tt>vector_indexing_suite</tt> may still be derived to further tweak any of the predefined policies. Static polymorphism through CRTP (James Coplien. "Curiously Recurring Template Pattern". C++ Report, Feb. 1995) enables the base <tt>indexing_suite</tt> class to call policy function of the most derived class </td>
665          <td>&nbsp; </td>
666        </tr>
667      </table>
668      <pre>
669    template &lt;<br>        class Container,<br>        bool NoProxy = false,<br>        class DerivedPolicies = unspecified_default<br>    class map_indexing_suite : unspecified_base<br>    {<br>    public:<br><br>        typedef typename Container::value_type value_type;<br>        typedef typename Container::value_type::second_type data_type;<br>        typedef typename Container::key_type key_type;<br>        typedef typename Container::key_type index_type;<br>        typedef typename Container::size_type size_type;<br>        typedef typename Container::difference_type difference_type;<br><br>        static data_type&amp;<br>        get_item(Container&amp; container, index_type i);
670
671        static void<br>        set_item(Container&amp; container, index_type i, data_type const&amp; v);
672
673        static void
674        delete_item(Container&amp; container, index_type i);<br>     
675        static size_t
676        size(Container&amp; container);
677     
678        static bool
679        contains(Container&amp; container, key_type const&amp; key);
680     
681        static bool<br>        compare_index(Container&amp; container, index_type a, index_type b);
682<br>        static index_type
683        convert_index(Container&amp; container, PyObject* i);
684    };
685
686</pre>
687      <hr>
688      &copy; Copyright Joel de Guzman 2003. Permission to copy, use, modify,
689      sell and distribute this document is granted provided this copyright
690      notice appears in all copies. This document is provided "as is" without
691      express or implied warranty, and with no claim as to its suitability
692      for any purpose.
693    </div>
694  </body>
695</html>
Note: See TracBrowser for help on using the repository browser.