How can i declare a Boost.Python C++ Class with PyObjects
问题 i want to write a c++ class with PyObjects to access them from Python to reference them with an existing Python object instance. In short words i want to store/manage Python object instances in the C++ class. For example: struct Var { PyObject *Test_1; PyObject *Test_2; }; #include <boost/python.hpp> using namespace boost::python; BOOST_PYTHON_MODULE(Var) { class_<Var>("Var", init<std::string>()) .def_readwrite("Test_1", &Var::value) .def_readwrite("Test_2", &Var::value) ; } in python i want