使具有指针作为参数的函数与 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*)
>>>