How to converter std::string* in boost.python?I have to handle some data of
c++ in python.The data may be big.So I return a pointer to python. But
there are some errors.

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)
    ;}


python

import ctopy
t1=ctopy.A()
print t1.ss     #error.TypeError:No to_python (by-value) converter
found for c++ type:std::string*
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to