hi guys,<br><br>i am trying to use references with boost python. <br><br>in python you can do:<br><br>class person:<br> name='david'<br><br>a=person()<br>b=a<br>print <a href="http://a.name">a.name</a><br>a.name='john'<br>
print <a href="http://b.name">b.name</a><br><br>because b is a reference, it will always change as a changes. hence <a href="http://b.name">b.name</a> is also john.<br><br>i want this functionality between boost and python.
<br><br>I have the C++ class:<br><br>class_<Window>("Window")<br> .def_readwrite("seat", &Window::seat)<br> ;<br><br>where seat is an object of class Seat. Seat contains an integer attribute named position. It's default value is 45.
<br><br>My python code is <br><br>s=Seat()<br>w=Window()<br>print s.position # prints 45<br>w.seat.position=s.position<br>s.position=66<br>print w.seat.position # prints 45<br>print s.position # prints 66<br><br>this shows that it isn't passed by reference as print
w.seat.position needs to be 66<br><br>How can i used references?<br><br>thanks<br><br><br>