[C++-sig] Re: boost.python: problem exposing static attribute with specific to_python converter

David Abrahams dave at boost-consulting.com
Sat Jan 8 17:25:38 CET 2005

Baptiste Lepilleur wrote:

>     Is this a bug ?

No, just bad instructions from me.  Clearly the docs don't give all the
information neccessary to get it right or I would have given you good
instructions :(

>     I got it working using:
>       .add_static_property( "staticVar",
>          make_getter(&TestString::staticVar,
>             return_value_policy<copy_non_const_reference>() ) )
>     Is there a way to change the return type used in the function generated
> by make_getter to be by value instead of by reference, so that the
> default_call_policies could be used ?

No, but of course you can always make your own getter function that
returns by value.  It's hard to say which would be preferable.

Dave Abrahams
Boost Consulting

More information about the Cplusplus-sig mailing list