4

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

1 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.