views:

102

answers:

1

Hello, I am getting a compile error, saying that the copy constructor of the scoped_ptr is private with the following code snippet:

class a {};

struct s
{
  boost::scoped_ptr<a> p;
};

BOOST_PYTHON_MODULE( module )
{
  class_<s>( "s" );
}

This example works with a shared_ptr though. It would be nice, if anyone knows the answer. Thanks

+6  A: 

The semantics of boost::scoped_ptr prohibit taking copies, while shared_ptr is intended to be copied. The error you are getting is the compiler telling you that some of the code (macro expansion?) is trying to copy the scoped_ptr but that the library does not allow the copy to be made.

David Rodríguez - dribeas