mercredi 31 août 2016

C++ std::array wrapper for Cython

I use Cython to wrap my C++ classes. Some of methods return sth. like std::array<class_name, 2>. My code looks like extended example from here: http://ift.tt/2bCxfbz. But I don't see a way to tell Cython to automatically convert this to Python's list. When class_name is a simple type (like int), that should be pretty easy. But I also want to be able to use it with complicated C++ classes (for which I created cython cdefs in pxd file and python defs in pyx file)

I know a workaround: in my original C++ code to create methods that return vectors instead of arrays, but that looks ugly and doesn't solve the second problem.

Aucun commentaire:

Enregistrer un commentaire