[C++-sig] custom r-value converters

Roman Yakovenko roman.yakovenko at gmail.com
Mon Mar 29 22:31:15 CEST 2010


On Mon, Mar 29, 2010 at 10:08 AM, Nathan Stewart <swarfrat at gmail.com> wrote:
> Ok some follow up - I now rip through my exposed classes looking for
> String_mgr typed properties to create custom get/setters for.Then, I set the
> following for that property:
>
> for c in classes:
>     for property in c.public_members:
>             if 'CustomString' in property.decl_string:
>                 property.set_use_make_functions( True )
>                 property.set_getter_call_policies( property.return_by_value
> )
>                 property.set_setter_call_policies( property.return_by_value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

May be I am missing something, but (py++) variable_t class doesn't
have return_by_value property.

> )
>
> What is generated instead looks like this
>
>        .add_property( "name"
>                         , bp::make_getter( &Update::name,
> bp::return_internal_reference< >() )
>                         , bp::make_setter( &Update::name ) )
>
> when I expected it to look like:
>
>        .add_property( "name"
>                         , bp::make_getter( &Update::name,
> bp::return_by_value() )
>                         , bp::make_setter( &Update::namem
> bp::return_by_value() ) )
>
> It's a property, and it occurs to me that it might not be a callable object.
> But I don't have one at this point - make_getter/setter is creating it. What
> am I doing wrong here?

I am not sure. What py++ version do you use?
Can you post small and complete example, of what you are trying to do?


-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/


More information about the Cplusplus-sig mailing list