给出两个类:
class B {
// ...
};
class A {
public:
B& b() { return *b_; }
private:
B* b_;
};
在Boost.Python模块中,我有
bp::class_<B, boost::noncopyable>(...)...;
工作正常。我也有
bp::class_<A, boost::noncopyable>(...)
.def("b", &A::b,
bp::return_internal_reference<>()
)
但它没有编译。它说:
/opt/local/include/boost/python/detail/caller.hpp:102:109: error: 'struct boost::python::detail::reference_existing_object_requires_a_pointer_or_reference_return_type<B>' has no member named 'get_pytype'
但是,它应该有一个pytype,对吧?