boostorg / boostorg/python

boost::python fails to handle std::unique_ptr as object holder

オープン
#202 コメント 12 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
537
フォーク
223
平均マージ
11時間 22分
マージ済み PR(30日)
2

説明

In ticket https://svn.boost.org/trac10/ticket/7711, 5 years ago, somebody complained that `std::unique_ptr` cannot be used as an object holder in boost::python. Although the ticket was closed, I still have the problem (in boost 1.58). Is there a solution available?

```cpp
#include
#include

struct Foo {};

BOOST_PYTHON_MODULE(foo) {
// This compiles fine.
boost::python::class_<
Foo
, std::auto_ptr
, boost::noncopyable
>("Foo1", boost::python::no_init)
;

// This doesn't compile.
boost::python::class_<
Foo
, std::unique_ptr
, boost::noncopyable
>("Foo2", boost::python::no_init)
;
}
```

Compile error (`std::unique_ptr` misses copy constructor):
`usr/include/boost/python/object/make_ptr_instance.hpp:24:38:
error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = moveit::python::Foo; _Dp = std::default_delete]’
`

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。