I would think that .def_readwrite would do what you need. If it doesn't look at using .def_property and get/set pair. Caveat: making sure that 'a' stays a valid reference is your problem. Python will happily crash horribly (if you are lucky) in response to bogus pointers or references.
-----Original Message----- From: cplusplus-sig-bounces+matthew.scouten=tradingtechnologies....@python.org [mailto:cplusplus-sig-bounces+matthew.scouten=tradingtechnologies....@py thon.org] On Behalf Of Sebastian Kraemer Sent: Wednesday, July 22, 2009 9:16 AM To: cplusplus-sig@python.org Subject: [C++-sig] wrapping reference members Hi all, I'm a beginner of c++ and boost::python, so this may be a stupid question. When I have the following class: class Foo{ public: float &a; }; Is there some way to expose "a" in python? I would like to use it like a normal python attribute, e.g. set it's value with "Foo().a = 3.1". Thanks for any help, Sebastian _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig