Boost logo

Boost :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2008-06-10 17:19:48


Eric Niebler <eric <at> boost-consulting.com> writes:

>
> Gennadiy Rozental wrote:
> > Hi,
 
> > I an using vector_indexing_suite for both standard containers export and for
> I believe you can use python::stl_input_iterator
> (boost/python/stl_iterator.hpp) to iterate over a python sequence, and
> it won't throw an exception.

No. I need iteration in python over exported c++ collection not to cause
exception to be generated in C++:

mymodule.cpp
    class_<std::vector<Foo>, boost::noncopyable >( "FooArray" )
        ....
        .def( vector_indexing_suite<std::vector<Foo> >() )
        ;

test.py:

def test_foo():
   arr = mymodule.FooArray( 5 )
   for e in arr:
       pass

This code causes an exception being thrown to stop iteration. I just wonder if
there is means to avoid it.

Gennadiy


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk