Thank you for the answer. Is there any way I can prevent it from copying the stream object even though std::ostream::write() returns a std::ostream& ?
On Wed, Sep 29, 2010 at 11:38 AM, Jakub Zytka <ku...@kormoran.net> wrote: > > > 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? > The problem is you are trying to copy a noncopyable object: > > > return class_<std::ostream, bases<std::ios>, >> boost::noncopyable>("ostream", no_init) >> > ostream is noncopyable > > > .def("write", write , >> return_value_policy<copy_non_const_reference>()) >> > but you define write to return copy (of ostream) > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig >
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig