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

Blaine Bell blaine.bell at schrodinger.com
Sun Jun 6 13:41:14 BST 2010

Phil Thompson wrote:
> 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
That's good to know.  This is very similar to what I used as a 
work-around.  Thanks!!!


More information about the PyQt mailing list