Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > swig/python problem: passing vector of objects.

Thread Tools

swig/python problem: passing vector of objects.

Bo Peng
Posts: n/a
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()

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

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

Many thanks in advance.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
const vector<A> vs vector<const A> vs const vector<const A> Javier C++ 2 09-04-2007 08:46 PM
Initializing vector<vector<int> > and other vector questions... pmatos C++ 6 04-26-2007 05:39 PM
Seg fault!: passing vector<vector<int> > to a function C++ 2 02-09-2007 05:31 PM
Free memory allocate by a STL vector, vector of vector, map of vector C++ 8 02-18-2006 12:48 AM
how the vector is created, how to pass vector to webservices method apachesoap:Vector Rushikesh Joshi Perl Misc 0 07-10-2004 01:04 PM