From 52245de2e5a24a12a0faedb80d677d866ef994bb Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Wed, 16 Apr 2008 03:07:06 +0000 Subject: [PATCH] Andreas patch [SVN r44449] --- .../boost/python/suite/indexing/container_utils.hpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/include/boost/python/suite/indexing/container_utils.hpp b/include/boost/python/suite/indexing/container_utils.hpp index a25185d0..72710bb8 100644 --- a/include/boost/python/suite/indexing/container_utils.hpp +++ b/include/boost/python/suite/indexing/container_utils.hpp @@ -7,9 +7,12 @@ #ifndef PY_CONTAINER_UTILS_JDG20038_HPP # define PY_CONTAINER_UTILS_JDG20038_HPP +# include +# include # include # include # include +# include namespace boost { namespace python { namespace container_utils { @@ -19,11 +22,13 @@ namespace boost { namespace python { namespace container_utils { { typedef typename Container::value_type data_type; - // l must be a list or some container - - for (int i = 0; i < l.attr("__len__")(); i++) + // l must be iterable + BOOST_FOREACH(object elem, + std::make_pair( + boost::python::stl_input_iterator(l), + boost::python::stl_input_iterator() + )) { - object elem(l[i]); extract x(elem); // try if elem is an exact data_type type if (x.check())