[C++-sig] Wrapping pointers

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Wed Apr 19 23:05:22 CEST 2006


--- Dominic Sacr� <dominic.sacre at gmx.de> wrote:
> .def("get_p", &A::get_p, return_value_policy<reference_existing_object>())
> 
> but I'd rather be able to access p as a data member rather than a method. 
> Any ideas?

I'd try:

  .add_property("p", make_function(&A::get_p,
return_value_policy<reference_existing_object>()))

See also: http://www.boost.org/libs/python/doc/v2/make_function.html


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Cplusplus-sig mailing list