Hi, Im trying to expose limited parts of std::ostream like this: { class_<std::ios_base, boost::noncopyable>("iosbase", init<const std::ios_base&>()) ;
class_<std::ios, bases<std::ios_base>, boost::noncopyable>("ios", init<std::streambuf*>()) ; std::ostream&(std::ostream::*write)(const char*, std::streamsize) = &std::ostream::write; return class_<std::ostream, bases<std::ios>, boost::noncopyable>("ostream", no_init) .def("write", write , return_value_policy<copy_non_const_reference>()) ; } When I call a python function from a C++ wrapper class: virtual Uint32 serialise(const GameObject* obj, std::ostream& file) { try { if(boost::python::override f = get_override("serialise")) return f(boost::python::object(boost::python::ptr(obj)), boost::python::object(boost::python::ptr(&file))); else return ComponentSystem::serialise(obj, file); } catch(...) { PyErr_Print(); } } I get this error: *TypeError: No to_python (by-value) converter found for C++ type: class std::basic_ostream<char,struct std::char_traits<char> >* This is the python function * def serialise(self, gameobj, file): if(gameobj in self.components): file.write("HEY", 3)* What's the problem here? Is is because the ostream argument is an reference? Thanks!
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig