[C++-sig] iterate a boost::python::list
Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Fri May 22 00:45:09 CEST 2009
It should work like this (untested):
boost::python::ssize_t n = boost::python::len(your_list);
for(boost::python::ssize_t i=0;i<n;i++) {
boost::python::object elem = your_list[i];
}
----- Original Message ----
From: Hans Roessler <hansroessler at yahoo.de>
To: Development of Python/C++ integration <cplusplus-sig at python.org>
Sent: Thursday, May 21, 2009 2:08:03 PM
Subject: [C++-sig] iterate a boost::python::list
How can I iterate in C++ over a boost::python::list?
According to http://www.boost.org/doc/libs/1_39_0/libs/python/doc/v2/list.html it has no begin() and end() functions.
Neither a size() function that would allow to call pop(size()-1). Neither an isEmpty() function that would allow to call pop(0) until the list is empty.
I'm sure I'm missing something trivial. Can somebody help me?
Thanks
Hans
More information about the Cplusplus-sig
mailing list