7 #ifndef PY_CONTAINER_UTILS_JDG20038_HPP 8 # define PY_CONTAINER_UTILS_JDG20038_HPP 10 # include <boost/python/object.hpp> 11 # include <boost/python/handle.hpp> 12 # include <boost/python/extract.hpp> 14 namespace boost {
namespace python {
namespace container_utils {
16 template <
typename Container>
20 typedef typename Container::value_type data_type;
24 for (
int i = 0; i < l.attr(
"__len__")(); i++)
27 extract<data_type const&>
x(elem);
31 container.push_back(
x());
36 extract<data_type>
x(elem);
39 container.push_back(
x());
43 PyErr_SetString(PyExc_TypeError,
"Incompatible Data Type");
44 throw_error_already_set();
void extend_container(Container &container, object l)