Boost logo

Boost :

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

Eric Niebler <eric <at>> 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++:

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

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

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


Boost list run by bdawes at, gregod at, cpdaniel at, john at