std::auto_ptr<> in constructor

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

std::auto_ptr<> in constructor

Tomasz Mikolajczyk

I'm a new user of boost::python art. I started to play a bit with the
code and the py++ code generator and encountered difficulties with the
std::auto_ptr in constructor.

The following code:

class A
     A(int value) : m_value(value) {}
     int m_value;

class B
     B(int value, std::auto_ptr<A> a) : m_value(value), m_a(a.release()) {}
     int m_value;
     std::auto_ptr<A> m_a;

has been bound to the following code:

     { //::A
         typedef bp::class_< A, boost::noncopyable > A_exposer_t;
         A_exposer_t A_exposer = A_exposer_t( "A", bp::init< int >((
bp::arg("value") )) );
         bp::scope A_scope( A_exposer );
         bp::implicitly_convertible< int, A >();
         bp::register_ptr_to_python< std::auto_ptr< A > >();

     bp::class_< B, boost::noncopyable >( "B", bp::init< int,
std::auto_ptr< A > >(( bp::arg("value"), bp::arg("a") )) );

Unfortunately, the generated code compiles with the error:
error: no matching function for call to
‘std::auto_ptr<A>::auto_ptr(const std::auto_ptr<A>&)’

I understand the error but I don't know what to do to avoid it. Please help.


Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
Boost-langbinding mailing list
[hidden email]