Re: [pygccxml-development] special functions/operators
Brought to you by:
mbaas,
roman_yakovenko
|
From: Matthias B. <ba...@ir...> - 2006-08-25 18:00:26
|
Roman Yakovenko wrote:
>> >> struct X {};
>> >> X& addAssign (X& x1, X const& x2) { return x1; } // silly example
>> >>
>> >> I want this to do:
>> >> .def ("__iadd__", addAssign, return_self<>())
>> >
>> > I think that if you rename addAssign to __iadd__ this will work, but I
>> > am not sure.
>> >
>> > mb.free_function( 'addAssign' ).rename( '__iadd__' )
>>
>> I think this would only work when addAssign() was a member of X.
>
> In this case it would work, because first argument of the function is X&.
But in the generated Python bindings it would only be a global function
called __iadd__ and not a method X.__iadd__.
- Matthias -
|