[C++-sig] Re: How to wrap reference-returning method as a property?

Mike Rovner mike at nospam.com
Tue Jul 6 19:57:13 CEST 2004


Wirawan Purwanto wrote:

>        .add_property("hand", &Master::hand); // wouldn't work
>
> That interface wouldn't work since the reference's lifetime wasn't
> known/specified. Is there anyway to fix this problem? I did not see

>From BPL FAQ (http://tinyurl.com/24mnc):

.add_property("hand",
      make_function(&Master::hand,
return_value_policy<manage_new_object>()) )

HTH,
Mike








More information about the Cplusplus-sig mailing list