Boost logo

Boost Users :

Subject: Re: [Boost-users] [Python] Handling std::vector and boost::tuple
From: Johan Råde (johan.rade_at_[hidden])
Date: 2011-07-27 05:16:41


On 2011-07-20 03:09, Ravi wrote:
> On Friday 15 July 2011 08:53:19 Johan Råde wrote:
>> The following code fails with the error message:
>> "Boost.Python.ArgumentError: Python argument types in m.f(list) did not
>> match C++ signature: ..."
>>
>> How do I make it work? Do I have to write a custom translator?
>
> Unfortunately, yes. The example, as written, requires two conversions:
> - from python list (or any python sequence) to std::vector
> - python tuples to boost.tuple
>
> You can use the vector indexing suite (v2) for the first part, and the
> following for the second:
>
> http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/docs/troubleshooting_guide/automatic_conversion/tuples.hpp?revision=899&view=markup
>
> Regards,
> Ravi

Thank you for the advice.

When I saw your response, I had already written my own converter.
I will probably rewrite my code using the vector indexing suite.
The tuple conversion code also looks very useful and would be a valuable
addition to Boost.Python.

Best regards,
Johan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net