How can I wrap class functions that return a reference?

Hi guys, I'm very new to boost.python, so my question might have been already answered. I'm having a lot of trouble creating interfaces for class member functions that return a reference to an object. For example if we have the following class: class btQuadWord { protected: btScalar m_x; btScalar m_y; btScalar m_z; btScalar m_unusedW; public: SIMD_FORCE_INLINE const btScalar& getX() const { return m_x; } }; and we have the following interface code: class_<btQuadWord>("btQuadWord") .def("getX", &btQuadWord::getX) ; I would get the following error messages (ignore the line numbers): /usr/include/boost/python/detail/invoke.hpp: In function 'PyObject* boost::python::detail::invoke(boost::python::detail::invoke_tag_<false, true>, const RC&, F&, TC&) [with RC = boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<const btScalar&>, F = const btScalar& (btQuadWord::*)()const, TC = boost::python::arg_from_python<btQuadWord&>]': /usr/include/boost/python/detail/caller.hpp:199: instantiated from 'PyObject* boost::python::detail::caller_arity<1u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = const btScalar& (btQuadWord::*)()const, Policies = boost::python::default_call_policies, Sig = boost::mpl::vector2<const btScalar&, btQuadWord&>]' /usr/include/boost/python/object/py_function.hpp:38: instantiated from 'PyObject* boost::python::objects::caller_py_function_impl<Caller>::operator()(PyObject*, PyObject*) [with Caller = boost::python::detail::caller<const btScalar& (btQuadWord::*)()const, boost::python::default_call_policies, boost::mpl::vector2<const btScalar&, btQuadWord&> >]' interface.cpp:112: instantiated from here /usr/include/boost/python/detail/invoke.hpp:88: error: no match for call to '(const boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<const btScalar&>) (const float&)' Now, btScalar here is just a #define for double, I've had similar problems when the return reference is to a class object. Is there anyway to get around this problem? Thanks a lot. Patrick P.S. How do you get the full list of past mails from the mailing list?
participants (1)
-
Patrick Ye