boost.python で std::string* を変換する方法? python で c++ の一部のデータを処理する必要があります。データが大きい可能性があるため、python へのポインターを返します。しかし、いくつかのエラーがあります。
c++
#include <boost/python.hpp>
#include <string>
class A {
public:
A() {
data="342342fgsf";
ss=&data;
}
std::string *ss;
std::string data;
};
BOOST_PYTHON_MODULE(ctopy)
{
using namespace boost::python;
class_<A> ("A",init<>())
.add_property(ss,&A::ss)
;
}
パイソン
import ctopy
t1=ctopy.A()
print t1.ss #error.TypeError:No to_python (by-value) converter found for c++ type:std::string*