3#include <boost/python.hpp> 
    4#include <boost/python/implicit.hpp> 
    5#include <boost/python/module.hpp> 
    7namespace py = boost::python;
 
   15template <
class StdVectorType>
 
   24        if (!PySequence_Check(obj_ptr))
 
   27        py::list arr = py::extract<py::list>(obj_ptr);
 
 
   31    static void construct(PyObject* obj_ptr, py::converter::rvalue_from_python_stage1_data* data)
 
   33        py::list arr = py::extract<py::list>(obj_ptr);
 
   34        auto len = py::len(arr);
 
   36        using storage_type = py::converter::rvalue_from_python_storage<StdVectorType>;
 
   37        void* storage = 
reinterpret_cast<storage_type*
>(data)->storage.bytes;
 
   39        new (storage) StdVectorType;
 
   40        StdVectorType& vec = *
static_cast<StdVectorType*
>(storage);
 
   44        for (
long i = 0; i < len; ++i)
 
   45            vec[i] = py::extract<typename StdVectorType::value_type>(arr[i]);
 
   47        data->convertible = storage;
 
 
 
   55template <
typename StdVectorType>
 
   57    static PyObject* 
convert(
const StdVectorType& vec)
 
   59        boost::python::list l;
 
   60        for (
int i = 0; i < vec.size(); i++)
 
   62        return py::incref(l.ptr());
 
 
 
   70template <
typename StdVectorType>
 
   74    py::to_python_converter<StdVectorType, std_vector_to_python_list<StdVectorType> >();
 
 
Definition base_types_conversion.h:41
 
void convertStdVector()
Definition std_vector_conversion.h:71
 
Definition std_vector_conversion.h:16
 
static void * convertible(PyObject *obj_ptr)
Definition std_vector_conversion.h:22
 
python_list_to_std_vector()
Definition std_vector_conversion.h:17
 
static void construct(PyObject *obj_ptr, py::converter::rvalue_from_python_stage1_data *data)
Definition std_vector_conversion.h:31
 
Definition std_vector_conversion.h:56
 
static PyObject * convert(const StdVectorType &vec)
Definition std_vector_conversion.h:57