[C++-sig] iterator over list and sequences

Eric Niebler eric at boost-consulting.com
Tue Nov 29 05:48:36 CET 2005


Yves Secretan wrote:
> 
> In search for a simple way to iterate in C++ over a boost::python::list, 
> I only found a discussion about how nice it would be to have one 
> (http://mail.python.org/pipermail/c++-sig/2003-March/003528.html). So I 
> wrote a set of C++ iterators and ended up with a syntax a little more 
> complex than what was originally proposed by David Abrahams, but maybe I 
> missed something.
> 


We've already got one. :-) I wrote a STL iterator for python sequences. 
It is an input iterator over any iterable python object, not just lists. 
It has not yet been part of an official Boost release, but you can find 
it in Boost main CVS at boost/python/stl_iterator.hpp. It'll be part of 
the next major release.

Hope that helps,

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com



More information about the Cplusplus-sig mailing list