[C++-sig] returning auto_ptr, `No to_python converter' ?

Jacques A. Vidrine nectar-pycpp at celabo.org
Wed Jun 18 20:58:37 CEST 2003


Hi All!
Does this ring any bells?

  #include <memory>
  #include <string>
  #include <boost/python.hpp>   // Boost 1.30.0

  std::auto_ptr<std::string> example() {
	return std::auto_ptr<std::string>(new std::string("hello"));
  }

  using namespace boost::python;
  BOOST_PYTHON_MODULE(example) {
	def("example", example);
  }

  >>> import example
  >>> example.example()
  Traceback (most recent call last):
    File "<stdin>", line 1, in ?
  TypeError: No to_python (by-value) converter found for C++ type: St8auto_ptrISsE

Seems I'm missing something, but I can't quite put my finger on it :-)
Cheers,
-- 
Jacques Vidrine   . NTT/Verio SME      . FreeBSD UNIX       . Heimdal
nectar at celabo.org . jvidrine at verio.net . nectar at freebsd.org . nectar at kth.se




More information about the Cplusplus-sig mailing list