swig/python problem: passing vector of objects.

B

Bo Peng

Dear List,

I have had success in using vector.i of SWIG to map between

c++: foo(vector<int>)
python: foo([1,2,3])

However, the map of vector of objects fails:

c++: foo(vector<obj> )
python: a = obj()
foo([a])

Can anyone tell me
1. what exactly being passed to C++, a swig_pointer of a? Is there any
copy constructure invloved during parameter passing?
2. It would be best for me to pass pointers of objects, i.e., I would like
foo([a]) # python code
to do
foo(vector<obj*>)

Is there any easy way to do it? (I do not know how to write SWIG maps.)

Many thanks in advance.

Bo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top