开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜