boost::python fails to handle std::unique_ptr as object holder
- Langage dominant
- C++
- Étoiles
- 537
- Forks
- 223
- Merge moyen
- 11 h 22 min
- PR mergées (30 j)
- 2
Description
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]’
`
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.