swig/python problem: passing vector of objects.

Discussion in 'Python' started by Bo Peng, Jun 20, 2004.

  1. Bo Peng

    Bo Peng Guest

    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
    Bo Peng, Jun 20, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff
    Replies:
    0
    Views:
    719
  2. Replies:
    8
    Views:
    1,912
    Csaba
    Feb 18, 2006
  3. Keith Sabine
    Replies:
    0
    Views:
    578
    Keith Sabine
    Jun 6, 2008
  4. Replies:
    2
    Views:
    398
    Juha Nieminen
    Sep 8, 2008
  5. Thomas
    Replies:
    0
    Views:
    474
    Thomas
    Nov 14, 2008
Loading...

Share This Page