【发布时间】:2011-01-24 00:59:29
【问题描述】:
使具有指针作为参数的函数与 boost python 一起工作的最佳方法是什么? 我看到文档中有很多返回值的可能性,但我不知道如何使用参数。
void Tesuto::testp(std::string* s)
{
if (!s)
cout << " NULL s" << endl;
else
cout << s << endl;
}
>>> t.testp(None)
NULL s
>>>
>>> s='test'
>>> t.testp(s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Boost.Python.ArgumentError: Python argument types in
Tesuto.testp(Tesuto, str)
did not match C++ signature:
testp(Tesuto {lvalue}, std::string*)
>>>
【问题讨论】:
标签: python boost pointers arguments argument-passing