[C++-sig] how to return arbitrary (python-)objects from boost?
Stefan Seefeld
seefeld at sympatico.ca
Wed Apr 23 14:26:29 CEST 2008
Joerg,
I'm not sure I completely understand what you are trying to do, or
whether that's actually needed...
Joerg Kurlbaum wrote:
> Now i want my boost wrapper to return a QImage directly that is usable
> with pyqt4. But i have no idea how i can return arbitrary objects with
> boost. For the numpy array i used the num_utils and can then do
> something like this:
>
> return boost::python::extract<boost::python::numeric::array>(obj);
If you mean by 'arbitrary objects' python objects, you can certainly
pass those. In C++ they are spelled boost::python::object, and you can
pass them as function arguments or return values as any other type.
Conversion from C++ types to boost::python::object is implicit as long
as there are registered converters.
For a more specific answer it might be best if you show some code...
Regards,
Stefan
--
...ich hab' noch einen Koffer in Berlin...
More information about the Cplusplus-sig
mailing list