[C++-sig] V2 type_from_python question

Peter Bienstman pbienst at MIT.EDU
Fri Apr 5 22:52:40 CEST 2002


OK, one of the final hurdles. I'm trying to convert a Numerical Python
array to a C++ array type. For that I try

struct cVector_from_python
{
  static cVector execute(PyArrayObject& o)
  {
    // do stuff
    return cVector(/* some params */);
  }
};

type_from_python<&PyArray_Type, cVector_from_python>();

This gives compiler errors: 

/home/pbienst/boost_cvs/boost/boost/python/type_from_python.hpp: In
constructor
   `boost::python::type_from_python<python_type,
Extractor>::type_from_python()
   [with const PyTypeObject*python_type = (&PyArray_Type), Extractor =
   cVector_from_python]':
/home/pbienst/camfr_work/camfr/camfr_wrap2.cpp:434:   instantiated from
here
/home/pbienst/boost_cvs/boost/boost/python/type_from_python.hpp:86: no
matching
   function for call to `extractor_type_id(cVector (*)(PyArrayObject&))'

Looking more closely at the examples, I see that all of the 'execute'
functions return a reference, which is of course not an option in my
case.

Am I doing something wrong?

Thanks,

Peter








More information about the Cplusplus-sig mailing list