
Sebastien Fortier wrote:
Thank you very much Daniel!
I had another question, is it possible to use multi_array and const_multi_array_ref together in python. What I mean is, if I create a multi_array from python through my c++ functions and I want to pass this array to another c++ function that uses a const_multi_array_ref how do I manage this in the interface file? is this possible?
I added class_
("const_multi_array_2d_ref"); to my interface file but the types seem to be incompatible.
You need to let Boost.Python know that the types are convertible:
implicitly_convertible<
multi_array
();
implicitly_convertible<
multi_array
();
Should do it. See http://www.boost.org/libs/python/doc/v2/implicit.html.
I would prefer to use the const_multi_array_ref with the multi_arrays to avoid copies...
If you already have multi_array's, why don't you just pass them by reference? -- Daniel Wallin