[C++-sig] boost python references
Roman Yakovenko
roman.yakovenko at gmail.com
Sun Apr 16 13:12:52 CEST 2006
On 4/16/06, david stummer <stummer at gmail.com> wrote:
> ok, i added a member function to Window which takes a Seat reference:
>
> void Window::AddSeat(Seat &s)
> {
> seat=s;
> }
>
> class_<Window>("Window")
> .def("FindWindow", make_function(&Window::AddSeat))
>
> .def_readwrite("seat", &Window::seat)
> ;
>
> using make_function like you said, although this doesn't seem to have any
> effect.
>
> I thank you for your patience - i am a newbie
:-). You missed important note:
There is one important difference between Python code and C++.
In Python you create value that belongs to class, while in C++ you
create value that belongs to class instance. I think you should use
add_static_property
function.
make_function you should use in order to setup call policies
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the Cplusplus-sig
mailing list