[PyQt] passing a list by reference to C++ and back....

Phil Thompson phil at riverbankcomputing.com
Sun Jun 6 12:15:12 BST 2010


On Fri, 04 Jun 2010 08:01:42 -0400, Blaine Bell
<blaine.bell at schrodinger.com> wrote:
> Hi,
> 
> I have a function that I want to wrap in Python that has a 
> "std::vector<> &"argument.  Is it possible to set the changes of the c++ 
> object back to the python object?  I have mapped this std::vector<> type 
> to a %MappedType, so I can implement %ConvertFromTypeCode and 
> %ConvertToTypeCode.  It seems like for all ConvertFromTypeCode blocks 
> they create new objects, but how do I get the original Python Object 
> inside this block so I can change it? (I probably need to check to see 
> if its available first?)

The nearest you can get is something like...

    void foo(std:vector<int> & /In,Out/);

...then in Python...

    lst = foo(lst)

Phil


More information about the PyQt mailing list