[C++-sig] Re: iterate through boot::python::list

David Abrahams dave at boost-consulting.com
Tue Mar 11 16:39:02 CET 2003


Dirk Gerrits <dirk at gerrits.homeip.net> writes:

> As Dave mentioned, you need to use x.attr("__len__")(). Notice the
> *additional* pair of braces.

True, but that result is just an 'object'.  He needs
extract<std::size_t>(x.attr("__len__")()) to get a size_t out of it.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list