boost::python fails to correctly handle constness of wrapped classes
- Langage dominant
- C++
- Étoiles
- 537
- Forks
- 223
- Merge moyen
- 11 h 22 min
- PR mergées (30 j)
- 2
Description
I want to wrap C++ code that only provides `const` access to a class `Foo`:
```cpp
struct Foo {};
std::shared_ptr producer();
```
Wrapping `Foo` as usual:
```cpp
BOOST_PYTHON_MODULE(foo) {
boost::python::class_, boost::noncopyable>("Foo", boost::python::no_init);
boost::python::def("producer", &producer);
}
```
compiles fine, but complains at runtime - obviously - about a missing type converter:
`No to_python (by-value) converter found for C++ type: std::shared_ptr`
Alternatively trying:
```cpp
BOOST_PYTHON_MODULE(foo) {
// const holder
boost::python::class_, boost::noncopyable>("Foo", boost::python::no_init);
// const class + holder
boost::python::class_, boost::noncopyable>("Foo", boost::python::no_init);
}
```
yields compile-time errors about constness issues. Isn't there a solution available that respects constness?
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.