Exposing boost::scoped_ptr in boost::python
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;
};
B开发者_Go百科OOST_PYTHON_MODULE( module )
{
class_<s>( "s" );
}
This example works with a shared_ptr though. It would be nice, if anyone knows the answer. Thanks
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.
精彩评论