Connecting Tech Pros Worldwide Forums | Help | Site Map

swig/python problem: passing vector of objects.

Bo Peng
Guest
 
Posts: n/a
#1: Jul 18 '05
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

Closed Thread