Hello everyone,
I started using Cython today to wrap my C++ code and I run into a problem, for which I didn't find any solution.
Considering I have two C++ classes, A and B, and the following Python respective PyA and PyB classes,
cdef class PyA:
cdef A *thisptr
def __cinit__(self):
self.thisptr = new A()
def __dealloc__(self):
del self.thisptr
(...)
cdef cppclass PyB:
cdef B *thisptr
def __cinit__(self):
self.thisptr = new B()
def __dealloc__(self):
del self.thisptr
def process(self, map[int, A] a):
self.thisptr.process(a)
Considering that the function PyB.process() receives a C++ type map I would expect Cython to convert it automathically like std::map <=> dict. However, I get this message:
Cannot convert Python object argument to type 'map[int,A]'
Which leads me to think that Cython does not know how to convert a dictionary with PyA objects to a C++ map with A objects (which is understandable). Would you know a way to make this work (preferably clean and easy)?
Thanks for your help in advance!
Regards,
Francisco