[Python] Handling std::vector and boost::tuple
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?
C++:
void f(const vector
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
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:
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
participants (2)
-
Johan Råde
-
Ravi