boost::python fails to handle std::unique_ptr as object holder
- Lenguaje dominante
- C++
- Estrellas
- 537
- Forks
- 223
- Merge medio
- 11 h 22 min
- PR fusionados (30 d)
- 2
Descripción
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]’
`
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.