Hi, I've been trying to make the following code work
*class Bar{ public: Bar():_int(4){}; ~Bar(){}; int get() {return _int;} private: int _int; }; class Foo { public: Foo():_bar(Bar()){}; ~Foo(){}; Bar& get_bar(){return _bar;} private: Bar _bar; }; #include <boost/python.hpp> BOOST_PYTHON_MODULE(test) { using namespace boost::python; class_<Bar>("Bar") .def("get",&Bar::get) ; class_<Foo>("Foo") .add_property("bar", make_getter(&Foo::get_bar,return_value_policy<copy_non_const_reference>()) ) ; }* The idea is to expose the _bar member via the get() function. I dont want to use def_readonly (since this is a dummy test case for a more general problem I am facing of using getters with functons returning references) I get a compile error, with the source of the error in the return value policy . The error log is attached. I also tried return_internal_reference<>(), and return_value_policy<return_by_value>, but both give compilation errors. Any help is appreciated regards, anirudh
compile_log
Description: Binary data
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig