I have the following class: class PyWav { public: static inline boost::python::object sdVecToNumpyArray(std::vector const& vec) { npy_intp size = vec.size(); double * data = size ? const_cast(&vec[0]) : static_cast(NULL); PyObject * pyObj = PyArray_SimpleNewFromData(1, &size, NPY_DOUBLE, data); boost::python::handle<> handle ( pyObj ); boost::python::numeric::array arr(handle); return arr.copy(); } // Access function inline boost::python::numeric::array toNumPy() { std::vector v = Signal(); // get the vector boost::python::numeric::array arr = Lib::python::PyWav::sdVecToNumpyArray( v); return arr; } };
The problem is I do not know how to access the stdVecToNumpyArray and pass through the vector? I want the method "toNumPy()" to be open to the user, but, not the sdVecToNumpyArray
I get the following error: error: conversion from ‘boost::python::api::object’ to non-scalar type ‘boost::python::numeric::array’ requested v);
Anyone have any ideas?