5
使用boost python指針作爲參數的函數的最佳方法是什麼? 我發現文檔中有很多返回值的可能性,但我不知道如何用參數來做。指針參數來提升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*)
>>>
通過在Boost.Python的一個參考一個問題,我們只能通過const引用,除非實現我們自己的引用包裝,你有什麼想法來實現這個嗎? – 2014-11-21 01:03:17