[C++-sig] call policies
Stefan Seefeld
seefeld at sympatico.ca
Fri Oct 18 17:56:59 CEST 2002
David Abrahams wrote:
> Bar* BarFactory(std::auto_ptr<Foo> foo);
>
> class_<Foo, std::auto_ptr<Foo> >("Foo")
> ...
> ;
I'm trying to do what you suggest, with some additional parameters:
----
#include <boost/python/module.hpp>
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>
#include <memory>
namespace python = boost::python;
namespace
{
class Bar {};
}
BOOST_PYTHON_MODULE(pfe)
{
python::class_<Bar,
std::auto_ptr<Bar>,
boost::noncopyable> bar("Bar", python::no_init);
}
----
I copied that over 'getting_started2.cc and run
bjam "-sBUILD=<architecture>mips4" (with TOOLS=mipspro).
This results in the error message
cc-1306 CC: ERROR File =
/homes/Developer/sseefel/boost/boost/python/object/make_instance.hpp,
Line = 60
Class "std::auto_ptr<<unnamed>::Bar>" has no copy constructor to copy
a const
object.
return new ((void*)&result->storage) Holder(x);
...
what is wrong ? I guess it's either boost:noncopyable or python::no_init
though I don't see why that should be wrong.
Thanks,
Stefan
More information about the Cplusplus-sig
mailing list