boost::python fails to correctly handle constness of wrapped classes
- Ngôn ngữ chính
- C++
- Star
- 537
- Fork
- 223
- Merge trung bình
- 11 giờ 22 phút
- Pull request đã merge (30 ngày)
- 2
Mô tả
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?
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.