Re: [C++-sig] wrapping reference members

2009-07-22 Thread Sebastian Kraemer
Thanks for the answer! ___ Cplusplus-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] wrapping reference members

2009-07-22 Thread Sebastian Kraemer
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. Thanks for

[C++-sig] wrapping reference members

2009-07-22 Thread Sebastian Kraemer
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